php.exe 执行 .php文件
代码如下:
<?php echo "hello php"; echo __FILE__; $path1 = "test_schedule.txt"; $path2 = dirname(__FILE__)."\\"."test_schedule.txt"; $fp=fopen($path1, "a+"); fwrite($fp, date("Y-m-d H:i:s") . " path1 success!\n"); $fp=fopen($path2, "a+"); fwrite($fp, date("Y-m-d H:i:s") . " path2 success!\n"); fclose($fp); ?>
值得注意的一点是:
在cmd命令窗口下通过执行命令: php.exe "D:\Workspace\test.php (环境变量设好后)
与你通过浏览器访问test.php
两个path, $path1和$path2在后一种环境下是一样的,但在前一种环境下是不一样的,
在cmd命令窗口下$path1返回的是:C:\Users\【用户账户】\test_schedule.txt
相关推荐
zyyjay 2020-11-09
xuebingnan 2020-11-05
samtrue 2020-11-22
stefan0 2020-11-22
yifangs 2020-10-13
songshijiazuaa 2020-09-24
hebiwtc 2020-09-18
天步 2020-09-17
83911535 2020-11-13
whatsyourname 2020-11-13
zhouyuqi 2020-11-10
Noneyes 2020-11-10
mathchao 2020-10-28
王志龙 2020-10-28
wwwsurfphpseocom 2020-10-28
diskingchuan 2020-10-23
savorTheFlavor 2020-10-23