【发布时间】:2011-09-28 22:39:25
【问题描述】:
我是 Linux/Ubuntu 的新手,所以如果我犯了任何愚蠢的错误,请原谅我。
我的代码在 XP 中运行良好,但在 Ubuntu 11.04(相同的 PHP/MySQL 版本)中无法运行
<?php
if (!isset($_SESSION['uid'])) {
header('Location:index.php');
exit;
} else {
if (file_exists("profile_pic/".$_SESSION['uid'].".jpg")) {
echo '<a href="'.$SitePath.'profile.php?id='.$_SESSION['uid'].'"><img src="'.$SitePath.'profile_pic/'.$_SESSION['uid'].'.jpg" alt="'.$_SESSION['name'].'" title="Me" border="0"/></a>';
} else {
echo '<a href="'.$SitePath.'profile.php?id='.$_SESSION['uid'].'"><img src="'.$SitePath.'profile_pic/nopic.jpg" alt="'.$_SESSION['name'].'" title="Me" border="0" /></a>';
}
?>
如果存在名称为$_SESSION['uid'].".jpg" 的文件,则显示它,否则显示默认图像。
我遇到的错误
可捕获的致命错误:mysqli_stmt 类的对象无法转换为字符串
【问题讨论】:
-
为什么你认为是file_exists的问题?
-
请添加错误消息指向的行。至少我在代码中看不到任何与 mySQLi 语句相呼应的行。
-
相信我该文件中没有 SQL 尽管某些包含文件有
-
这个问题存在于所有有
file_exist的页面中 -
1.尝试回显 $_SESSION['uid']; 2. 尝试回显 file_exists("/ect/hosts");