0

这个 HTTP 标头是什么意思?

if (!defined('DIR_APPLICATION')) { 
    header('Location: install/index.php'); 
    exit; 
}

它是 OpenCart (PHP) 代码的一部分。

DIR_APPLICATION 是常量还是目录?在这种情况下,标题是什么意思?

在阅读了 Mozilla Developer NetworkW3C之后,我仍然无法理解。

提前致谢

4

2 回答 2

2

DIR_APPLICATION是一个常量,可能应该保存应用程序的安装目录,如果它失败了defined()检查,这意味着它没有被设置/定义为安装的一部分,它会使用header()导致重定向到的方式将 HTTP 标头发送到客户端install/index.php

于 2013-11-12T19:06:28.473 回答
2

DIR_APPLICATION is actually the constant defined to say where the main directory holding the controller, language, model and view directories are for the Admin/Catalog sections of the application. It is a full path structure of the local file system to the directory that is written to the config.php when the installation is completed. It is defined in each of the two config.php files and as such if it isn't defined, OpenCart assumes that there's not been an installation and redirects to the installation script. Not sure why you've referred to it as a header though as it's in no way a header

于 2013-11-12T19:57:43.983 回答