Below is my code,
test.php
<?php
$prefixnew = "testnew";
$file1 = fopen("testnew.txt","w");
$content_wr_g = "Test sitest"
fwrite($file1,$content_wr_g);
fclose($file1);
?>
test.bat
@ECHO off
C:\wamp\bin\php\php5.3.13\php.exe -f "C:\...\test.php"
popd
UPDATE
When i run (test.php) directly from browser it is working properly. if i run from scheduled tasks, it is not working.
I know very well about task scheduler steps to create a task. When i run set of update queries or delete queries means, it working nicely.
When i have code like fopen(), fwrite()
etc it is not working
Instead of using relative path, use absolute path to the file:
$file1 = fopen(__DIR__.'/testnew.txt', 'w');
I assume you are using >= PHP 5.3
, if not try:
$file1 = fopen(dirname(__DIR__).'/testnew.txt', 'w');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.