这是zen cart的代码,谁能给我解释一下啊,我看不懂

wyj518 2009-07-20 11:48:20

这是zen cart的代码,谁能给我解释一下啊,我看不懂
<?php
/**
* application_top.php Common actions carried out at the start of each page invocation.
*
* Initializes common classes & methods. Controlled by an array which describes
* the elements to be initialised and the order in which that happens.
* see {@link http://www.zen-cart.com/wiki/index.php/Developers_API_Tutorials#InitSystem wikitutorials} for more details.
*
* @package initSystem
* @copyright Copyright 2003-2007 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: application_top.php 7470 2007-11-24 20:54:50Z drbyte $
*/
/*
* turn off magic-quotes support, for both runtime and sybase, as both will cause problems if enabled
*/
set_magic_quotes_runtime(0);
if (@ini_get('magic_quotes_sybase') != 0) @ini_set('magic_quotes_sybase', 0);
/**
* boolean if true the autoloader scripts will be parsed and their output shown. For debugging purposes only.
*/
define('DEBUG_AUTOLOAD', false);
/**
* boolean used to see if we are in the admin script, obviously set to false here.
*/
define('IS_ADMIN_FLAG', false);
/**
* integer saves the time at which the script started.
*/
define('PAGE_PARSE_START_TIME', microtime());
// define('DISPLAY_PAGE_PARSE_TIME', 'true');
@ini_set("arg_separator.output","&");
/**
* Set the local configuration parameters - mainly for developers
*/
if (file_exists('includes/local/configure.php')) {
/**
* load any local(user created) configure file.
*/
include('includes/local/configure.php');
}
/**
* set the level of error reporting
*
* Note STRICT_ERROR_REPORTING should never be set to true on a production site. <br />
* It is mainly there to show php warnings during testing/bug fixing phases.<br />
* note for strict error reporting we also turn on show_errors as this may be disabled<br />
* in php.ini. Otherwise we respect the php.ini setting
*
*/
if (defined('STRICT_ERROR_REPORTING') && STRICT_ERROR_REPORTING == true) {
@ini_set('display_errors', '1');
error_reporting(E_ALL);
} else {
error_reporting(0);
}
/**
* check for and include load application parameters
*/
if (file_exists('includes/configure.php')) {
/**
* load the main configure file.
*/
include('includes/configure.php');
} else {
require('includes/templates/template_default/templates/tpl_zc_install_suggested_default.php');
exit;
}
/**
* if main configure file doesn't contain valid info (ie: is dummy or doesn't match filestructure, display assistance page to suggest running the installer)
*/
if (!defined('DIR_FS_CATALOG') || !is_dir(DIR_FS_CATALOG.'/includes/classes')) {
require('includes/templates/template_default/templates/tpl_zc_install_suggested_default.php');
exit;
}
/**
* include the list of extra configure files
*/
if ($za_dir = @dir(DIR_WS_INCLUDES . 'extra_configures')) {
while ($zv_file = $za_dir->read()) {
if (preg_match('/\.php$/', $zv_file) > 0) {
/**
* load any user/contribution specific configuration files.
*/
include(DIR_WS_INCLUDES . 'extra_configures/' . $zv_file);
}
}
$za_dir->close();
}
$autoLoadConfig = array();
if (isset($loaderPrefix)) {
$loaderPrefix = preg_replace('/[a-z_]^/', '', $loaderPrefix);
} else {
$loaderPrefix = 'config';
}
$loader_file = $loaderPrefix . '.core.php';
require('includes/initsystem.php');
/**
* determine install status
*/
if (( (!file_exists('includes/configure.php') && !file_exists('includes/local/configure.php')) ) || (DB_TYPE == '') || (!file_exists('includes/classes/db/' .DB_TYPE . '/query_factory.php')) || !file_exists('includes/autoload_func.php')) {
require('includes/templates/template_default/templates/tpl_zc_install_suggested_default.php');
header('location: zc_install/index.php');
exit;
}
/**
* load the autoloader interpreter code.
*/
require('includes/autoload_func.php');
/**
* load the counter code
**/
// counter and counter history
require(DIR_WS_INCLUDES . 'counter.php');

// get customers unique IP that paypal does not touch
$customers_ip_address = $_SERVER['REMOTE_ADDR'];
if (!isset($_SESSION['customers_ip_address'])) {
$_SESSION['customers_ip_address'] = $customers_ip_address;
}
?>
...全文
331 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
huanglongmiss 2011-04-16
  • 打赏
  • 举报
回复
不是太难.>
zhangyj007520 2010-03-15
  • 打赏
  • 举报
回复
学习了
akrick 2009-08-31
  • 打赏
  • 举报
回复
学习中…………6
ruanchao 2009-07-31
  • 打赏
  • 举报
回复
我觉得看注释会更好一些

1-33行 主要是初始化系统环境变量, 可以查看PHP手册来仔细看一下。

34-90行 从includes/configure.php和\includes\extra_configures文件中获取ZC的配置信息

91-110行 自动加载ZC的核心类和函数,这类文件的加载过程,可以从http://www.zen-cart.com/wiki/index.php/Developers_API_Tutorials中获取细节。

111-116行 我没有搞清楚有何作用。

117-121行 获取用户的IP

谢谢楼主,我还没有仔细去阅读这个文件中的代码,有空一定要仔细阅读,不然,谈不上熟悉Zen Cart了。
silasoni 2009-07-31
  • 打赏
  • 举报
回复
不难的嘛 哪一行看不懂啊
wyj518 2009-07-31
  • 打赏
  • 举报
回复
定,要详细介绍代码,不能句话概括啊
wyj518 2009-07-29
  • 打赏
  • 举报
回复
顶一下
jxncpbs 2009-07-29
  • 打赏
  • 举报
回复
安装文件啊
ruanchao 2009-07-20
  • 打赏
  • 举报
回复
建议你debug一下

20,359

社区成员

发帖
与我相关
我的任务
社区描述
“超文本预处理器”,是在服务器端执行的脚本语言,尤其适用于Web开发并可嵌入HTML中。PHP语法利用了C、Java和Perl,该语言的主要目标是允许web开发人员快速编写动态网页。
phpphpstorm 技术论坛(原bbs)
社区管理员
  • 开源资源社区
  • phpstory
  • xuzuning
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧