[英]fopen(), fwrite() function is not working in php
下面是我的代碼,
test.php
<?php
$prefixnew = "testnew";
$file1 = fopen("testnew.txt","w");
$content_wr_g = "Test sitest"
fwrite($file1,$content_wr_g);
fclose($file1);
?>
測試棒
@ECHO off
C:\wamp\bin\php\php5.3.13\php.exe -f "C:\...\test.php"
popd
更新
當我直接從瀏覽器運行(test.php)時,它工作正常。 如果我從計划任務運行,則無法正常工作。
我非常了解創建任務的任務計划程序步驟。 當我運行一組更新查詢或刪除查詢意味着,它運行良好。
當我有fopen(), fwrite()
等代碼時fopen(), fwrite()
它無法正常工作
代替使用相對路徑,而使用文件的絕對路徑:
$file1 = fopen(__DIR__.'/testnew.txt', 'w');
我假設您正在使用>= PHP 5.3
,如果不嘗試:
$file1 = fopen(dirname(__DIR__).'/testnew.txt', 'w');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.