这里为啥用exit

WBOY
Release: 2016-06-23 13:32:55
Original
775 people have browsed it

下面是ecshop的入口代码,是防止重新安装的,其中exit我不理解。
我现在的理解是:如果上面都不成立,那么就退出了。比如安装了后,然后程序读到这里,一看条件都满足就退出了,退然都退了,整个网站不全挂了,反过来,没有安装他给你安装一下,安装了,就退出执行整个网站程序了,这到底是什么回事,主要是exit的运行机制是啥
if (!file_exists(ROOT_PATH . 'data/install.lock') && !file_exists(ROOT_PATH . 'includes/install.lock')
    && !defined('NO_CHECK_INSTALL'))
{
    header("Location: ./install/index.php\n");

    exit;
}


回复讨论(解决方案)

没有安装就header跳向安装界面
下面的exit就是一种保险的写法吧,万一没跳,也不让你执行后面的程序
exit就是退出,不运行后面的程序

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template