关于文件的PHP错误 [英] PHP error with regard to files

查看:84
本文介绍了关于文件的PHP错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$id=$_REQUEST[''id''];
if($id == ""){
$id = "Home";
$ext = ".txt";
$path = "pages/";
$file = $_SERVER[''/home/a7120106/public_html/''] . ($path . $id . $ext);
$contents = file($file);
$string = implode($contents);
echo $string;
}
else{
$file = $_SERVER[''/home/a7120106/public_html/''] . ($path . $id . $ext);
$contents = file($file);
$string = implode($contents);
echo $string;
}



这是我的代码.例如,当我尝试加载除主页以外的页面时:视频.顺便说一句,我得到这个:

警告:文件(视频)[function.file]:无法打开流:第40行的/home/a7120106/public_html/index.php中没有此类文件或目录
警告:implode()[function.implode]:参数必须是第41行/home/a7120106/public_html/index.php中的数组.

我正在尝试使用id标签将文本文件中的内容加载到页面上.

请帮忙,干杯



This is my code. When I try to load a page other than home for example: Videos. Which by the way exists, I get this:

Warning: file(videos) [function.file]: failed to open stream: No such file or directory in /home/a7120106/public_html/index.php on line 40
Warning: implode() [function.implode]: Argument must be an array in /home/a7120106/public_html/index.php on line 41

I am trying to load content from a text file onto the page using id tags.

Please help, Cheers

推荐答案

id =


_REQUEST [''id'']; if(
_REQUEST[''id'']; if(


id =="){


这篇关于关于文件的PHP错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆