Correcting teacher:PHPz
Correction status:qualified
Teacher's comments:
全局变量,无法在函数体内直接被调用,可以用两种方式被间接调用:
(1).使用global关键字,可以间接访问
global $one,$two;
(2)可以用超全局变量访问 $GLOBALS.
$GLOBALS['one'];
$GLOBALS['two'];
//根路径
define('DAY',date('/md',time()));
define('ROOT_PATH',$_SERVER['DOCUMENT_ROOT'] . DAY . '/web1');
//数据路径
define('DATA_PATH', ROOT_PATH . '/data');
//模板路径
define('TMPL_PATH',ROOT_PATH . '/template');
//公共模板路径
define('TMPL_PUBLIC_PATH',TMPL_PATH . '/public');
//静态资源路径
define('STATIC_PATH', ROOT_PATH . '/static');
define('STATIC_CSS_PATH', STATIC_PATH . '/css');
define('STATIC_JS_PATH', STATIC_PATH . '/js');
define('STATIC_IMG_PATH', STATIC_PATH . '/images');
//每个页面引入配置文件
include __DIR__.DS.'config'.DS.'common.php';
// 新闻列表
<?php foreach($news as $k => $v):extract($v)?>
<a href="<?=$url?>" target="_blank"><?=mb_substr($title,0,18)?>...</a>
<?php endforeach ?>
// 产品列表
<?php foreach($items as $v):extract($v)?>
<div class="item">
<img src="<?=$img?>" alt="" />
<a href="<?=$url?>"><?=mb_substr($title,0,15)?>...</a>
</div>
<?php endforeach?>