首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >die()的PHP问题

die()的PHP问题
EN

Stack Overflow用户
提问于 2010-05-22 03:56:52
回答 4查看 199关注 0票数 2

所以,我有这样的代码:

代码语言:javascript
复制
        } else {

            $photograph_moderation = new PhotographModeration($this->photograph_id);
            $photograph_moderation->purgePhotograph();

            //eventually take to an error page
            die('image is not big enough to upload');

        }

当满足此条件时,将正确调用purgePhotograph()函数,但脚本似乎永远不会死。有没有什么原因导致die不会在这里被调用?purgePhotograph()也没有脚本终止命令。

下面是purge_photograph函数:

代码语言:javascript
复制
public function purgePhotograph() {

    $db = Connect::connect();
    $photograph_id = $db->real_escape_string($this->photograph_id);

    $query = "SELECT * from photographs WHERE id='{$this->photograph_id}'";
    $result = $db->query($query);
    $photograph = $result->fetch_assoc();

    if ($photograph['location'])
    unlink($photograph['location']);

    if ($photograph['thumbnail_location'])
    unlink($photograph['thumbnail_location']);

    if ($photograph['watermark_location'])
    unlink($photograph['watermark_location']);

    if ($photograph['xsmall_location'])
    unlink($photograph['xsmall_location']);

    if ($photograph['small_location'])
    unlink($photograph['small_location']);

    if ($photograph['medium_location'])
    unlink($photograph['medium_location']);

    if ($photograph['large_location'])
    unlink($photograph['large_location']);

    if ($photograph['xlarge_location'])
    unlink($photograph['xlarge_location']);

    if ($photograph['xxlarge_location'])
    unlink($photograph['xxlarge_location']);

    if ($photograph['xxxlarge_location'])
    unlink($photograph['xxxlarge_location']);

    $query = "DELETE from photographs WHERE id='{$this->photograph_id}'";
    $result = $db->query($query);

    $query = "DELETE from photograph_tags WHERE photograph_id='{$this->photograph_id}'";
    $result = $db->query($query);

}
EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2010-05-22 04:01:43

也许现在是安装php debugger module并开始编写相关代码的时候了。

xdebug和例如netbeans作为前端工作得足够好。

票数 1
EN

Stack Overflow用户

发布于 2010-05-22 03:59:22

检查purgePhotograph()是否返回。也许它有一个死循环,或者需要很长时间。

票数 2
EN

Stack Overflow用户

发布于 2010-05-22 04:03:06

哇,问题是purgePhotograph()最后从来没有返回值1。我不知道这是执行以下代码行所必需的。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2885157

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档