[英]fopen(), fwrite() function is not working in php
Below is my code, 下面是我的代码,
test.php 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. 当我直接从浏览器运行(test.php)时,它工作正常。 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 当我有fopen(), fwrite()
等代码时fopen(), fwrite()
它无法正常工作
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: 我假设您正在使用>= PHP 5.3
,如果不尝试:
$file1 = fopen(dirname(__DIR__).'/testnew.txt', 'w');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.