本文實例講述了隱性調用php程序的方法。分享給大家供大家參考。具體如下:
復制代碼 代碼如下:<mce:script language = "javascript" src = "count.php"></mce:script>
<?php $file_name = "count.txt"; $fp = fopen($file_name,"r"); //打開文件讀入當前計數 $count = fread($fp, filesize($file_name)); fclose($fp); $count++; //計數加1 $fp = fopen($file_name, "w"); //再次打開文件寫入更新後的計數 fwrite($fp, $count); fclose($fp); echo "document.write('".$count."')"; //輸出JavaScript代碼,返回計數 ?>
希望本文所述對大家的php程序設計有所幫助。