隐性调用php程序的方法_PHP
程序员文章站
2022-04-15 07:57:44
...
调用方法:
count.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代码,返回计数
?>
count.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实现redis数据库指定库号迁移的方法_php技巧
下一篇: 微信公众平台开发之天气预报功能