警告:filesize函数无法运行 [英] Warning : filesize function failing to operate
本文介绍了警告:filesize函数无法运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下代码:
<?php
$filevar = "/images/staunton/{$options_item['base_var']}.gif";
if(filesize($filevar) > 1616){
$setstatus = "enabled";
}
else{
$setstatus = "disabled";
}
?>
结果:
Warning: filesize() [function.filesize]: stat failed for /images/staunton/3-25.gif in [Originating PHPFILE(Edited)] on line 24
Path是正确的文件....我的托管服务器正在运行php 5.2 - 这是一个synax错误吗?我一直在寻找类似的代码,它看起来似乎是正确的。
The Path is the correct file.... my hosting server is running php 5.2 - is this a synax error? I've been looking at similar code and it seems to look correct.
推荐答案
而不是:
$filevar = "/images/staunton/{$options_item['base_var']}.gif";
你可能想要:
$filevar = $_SERVER["DOCUMENT_ROOT"] . "/images/staunton/{$options_item['base_var']}.gif";
因为您可能会混淆文档根目录中图像的相对路径你的页面与文件系统中图像的绝对路径。
because you probably was confusing the relative path of your image inside the document root of your page vs the absolute path of the image in the filesystem.
试试并评论回来。
这篇关于警告:filesize函数无法运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文