即使文件存在于my yii php应用程序中,file_exists也返回false
我读过很多与我题目相同的问题,但没有一个对我有帮助 上图是以下函数的输出即使文件存在于my yii php应用程序中,file_exists也返回false,php,yii,file-exists,Php,Yii,File Exists,我读过很多与我题目相同的问题,但没有一个对我有帮助 上图是以下函数的输出 foreach ( $products as $product) { $file = Library::getCatalogUploadPath().$product['image']; echo $file.'<br>'; if( file_exists($file)){ echo $file;
foreach ( $products as $product) {
$file = Library::getCatalogUploadPath().$product['image'];
echo $file.'<br>';
if( file_exists($file)){
echo $file;
}
else {
echo "no".'<br>';
}
}
这是“配置”…
'config' => array(
'site_url' =>
'http://l/git/cart.git/',//example:http://www.cartnex.org/
'document_root' => $_SERVER['DOCUMENT_ROOT'],
'upload_path'=>'git/cart.git/uploads/',
)
文件存在的证明:
文件名
$product['image']
格式不正确。它不包含文件扩展名,这就是为什么file\u exists()
返回false
文件扩展名在哪里?是的,右键单击那只小狗(哈哈),然后在属性中查看全名。@DanMiller,你指导了我正确的方向:)@请现在回答这个问题。
'config' => array(
'site_url' =>
'http://l/git/cart.git/',//example:http://www.cartnex.org/
'document_root' => $_SERVER['DOCUMENT_ROOT'],
'upload_path'=>'git/cart.git/uploads/',
)