Çë½ÌÒ»¸öphpµ¼³öexcelµÄÎÊÌâ
ÏÂÃæÊÇtest.htmlµÄÒ»¶Î´úÂ룬ΪʲôִÐÐtest1()£¬ÌáʾÏÂÔØexcelÎļþ£¬¶øtest2()´ò¿ªexcelexport.phpÖ®ºó£¬Ã»ÓÐÌáʾ±£´æ¾Í×Ô¶¯¹Ø±ÕÁË£¿
HTML code:
<input type="button" value="btn1" onclick="test1()"/>
<input type="button" value="btn2" onclick="test2()"/>
<script language="javascript" type="text/javascript">
function test1() {
window.open("excelexport.php");
}
function test2() {
window.setTimeout(test1,1);
}
</script>
excelexport.phpµÄ´úÂë:
PHP code:
<?php
header("Content-Type:application/force-download");
header("Content-Type:application/vnd.ms-execl");
header("Content-Type:application/octet-stream");
header("Content-Type:application/download");
header('Content-Disposition:attachment;filename="charging.xls"');
header("Content-Transfer-Encoding:binary");
?>
ллÁ½Î»£¬µ«ÊÇÓÃÄãÃǵķ½·¨£¬ÎÊÌ⻹ÊÇ´æÔÚ
µ¯³öµÄд°¿ÚÒ»ÉÁ¾ÍÏûʧÁË£¬Ã»ÓÐÌáʾÏÂÔØ
ÄãÃ÷°×setTimeout µÄÒâ˼Â𣿽¨ÒéÄãºÃºÃ¿´¿´ÊÖ²áÉÏÊÇÔõô˵µÄ
window.setTimeout(vCode, iMilliSeconds [, sLanguage])
ÎÒÀí½âÊ
Ïà¹ØÎÊ´ð£º
ÔÚ¹úÍâµÄ¿Õ¼ä£¬ÆäËüµÄphpÕ¾µã¶¼Õý³££¬¿ÉÖ»ÓÐ×î½ü½¨µÄÕâ¸öÕ¾µã£¬Ö»ÒªÒ»ä¯ÀÀphpÎļþ¾Í³öÏÖÏÂÔØÌáʾ£¬ÏÂÔØÏÂÀ´µÄÎļþ¶¼ÊÇ´øÓÐphpÔ´Â룬¸÷λ·¹ýµÄ£¬°ï°ïÎÒ£¬¿´¿´Ê²Ã´ÔÒò£¬ÏÈлÁË¡£
¿Õ¼ä²»Ö§³Ö¡£
»òÕßÄãµÄÕ˺ÅûÓп ......
1.¾«Í¨ÃæÏò¶ÔÏóµÄÉè¼ÆºÍ¿ª·¢£»
2.ÊìÁ·Ê¹ÓÃPHPÓïÑÔ(5.0+)½øÐÐÊý¾Ý¿â£¬ÍøÂçͨÐÅ£¬Îļþ¶Áд£¬°²È«»úÖÆµÈ¿ª·¢£»
3.ÊìÁ·Ê¹ÓÃMYSQL(5.0+)Êý¾Ý¿â¿ª·¢£¬°üÀ¨»ù±¾µÄÊý¾Ý¿âÉè¼Æ/ÓÅ»¯/°²È«£¬¸´ÔÓµÄT-SQLÓï¾ä±àд£¬ÊìÁ·±àдMYS ......
´úÂëÈçÏ£º
function uc_get_user($username, $isuid=0) {
$return = call_user_func(UC_API_FUNC, 'user', 'get_user', array('username'=>$username, 'isuid'=>$isuid));
return UC_CONNECT == 'mysql' ......
index.phpÄÚÈÝ£º
$smarty->assign('name',strtotime('-0'));
$smarty->display("index.html");
index.htmlÄÚÈÝ£º
{$name|date_format:'%Y-%m-%d'}<hr>
{$ ......
ÎÒµÄÏîÄ¿ËùÔڵĻ·¾³ÊÇphp+apache+linux
ÏÖÎÒÖØÆô·þÎñÊÇ service httpd restart
ÏÖÎÒÏë¶¨Ê±ÖØÆô´ËÏî·þÎñ£¨¶¨ÔÚÿÌìÏÂÎç4µã£© ÔõôʵÏÖѽ£¬¶àл
crontab
* 16 * * * service httpd restart
ѧϰ + d ......