php中fopen 的问题

来源:百度知道 编辑:UC知道 时间:2024/05/09 15:51:06
执行这句代码$file = fopen("/php_kejian/ceshi.txt","w+");
出现如下错误
Warning: fopen(/php_kejian/ceshi.txt) [function.fopen]: failed to open stream: No such file or directory in D:\PC_webserver\phproot\php_kejian\Wen_Jian_Xi_Tong_Han_Shu.php on line 22
请问错在哪里

"/php_kejian/ceshi.txt"
换成
realpath( "/php_kejian/ceshi.txt" )
试试,路径问题 ,总之第一个参数 不要以“/”开头

你的文件路径有问题
应该是fopen('ceshi.txt','w+');

是不是版本的问题。php4.4.2有这个漏洞。