table('category')." c ON g.cat_id=c">
时间:2021-07-01 10:21:17 帮助过:6人阅读
Parse error: parse error, unexpected T_VARIABLE in PHPDocument1 on line 6
//表 goods public function Goods($goods_id) { $sql = "SELECT g.goods_id,c.file_dir,c.parent_id,c.is_show AS c_is_show,g.is_show AS g_is_show ". " FROM ".self::$ecs->table('goods')." g ". " LEFT JOIN ".self::$ecs->table('category')." c ON g.cat_id=c.cat_id ". " WHERE g.goods_id='$goods_id' "; $rs = self::$db->getRow($sql); $arr = array(); if(!empty($rs)) { $arr['savepath'] = ($rs['g_is_show'] == 1 && $rs['c_is_show'] == 1) ? '/product/'.($rs['file_dir'] ? $rs['file_dir']:$rs['cat_id']).'/'.$rs['goods_id'].'.html' : ''; $arr['remoteurl'] = '/goods.php?id='.$rs['goods_id']; } return $arr; } //表 category public function Category($cat_id,$page = 1) { $sql = "SELECT c.cat_id,c.file_dir,c.parent_id,c.is_show ". " FROM ".self::$ecs->table('category')." c ". " WHERE c.cat_id='$cat_id' "; $rs = self::$db->getRow($sql); $arr = array(); if(!empty($rs)) { $arr['savepath'] = $rs['is_show'] == 1 ? '/product/'.($rs['file_dir'] ? $rs['file_dir']:$rs['cat_id']).'/index'.($page > 0 ? '-'.$page:'').'.html':''; $arr['remoteurl'] = '/category.php?id='.$rs['cat_id'].'&page='.$page; } return $arr; } //表article public function Article($article_id) { $sql = "SELECT a.article_id,c.cat_id,c.file_dir,c.is_open AS c_is_open ". " FROM ".self::$ecs->table('article')." a ". " LEFT JOIN ".self::$ecs->table('article_cat')." c ON a.cat_id=c.cat_id ". " WHERE a.article_id='$article_id' "; $rs = self::$db->getRow($sql); $arr = array(); if(!empty($rs)) { $arr['savepath'] = $rs['is_open'] == 1 ? '/article/'.($rs['file_dir'] ? $rs['file_dir']:$rs['cat_id']).'/'.$rs['article_id'].'.html' : ''; $arr['remoteurl'] = '/article.php?id='.$rs['article_id']; } return $arr; } //表 public function ArticleCat($cat_id,$page = 1) { $sql = "SELECT c.cat_id,c.file_dir,c.parent_id ". " FROM ".self::$ecs->table('article_cat')." c ". " WHERE c.cat_id='$cat_id' "; $rs = self::$db->getRow($sql); $arr = array(); if(!empty($rs)) { $arr['savepath'] = '/article/'.($rs['file_dir'] ? $rs['file_dir']:$rs['cat_id']).'/index'.($page > 0 ? '-'.$page:'').'.html'; $arr['remoteurl'] = '/article_cat.php?id='.$rs['cat_id'].'&page='.$page; } return $arr; }}
$arr = UrlPath::Goods(1024);print_arr($arr);
类变量不能使用变量的值来声明,需要额外写一个架构函数__construct来赋值
楼上说的对。