$this->redirect(_wapurl().$_SERVER['REQUEST_URI']);
exit();
}
}
}
public function index(){
$id=input('id/d');
$name=Db::name('product')->where(['id'=>$id,'hide'=>1])->cache(_cache('db'))->field('id,typeid,title,keywords,description,content,click,update_time,images,spec,mychannel,price,market,number,brand,sellout,stock,location')->find();
if (!$name){
throw new HttpException(404);//内容没有返回错误404
}
$name['content'] = htmlspecialchars_decode($name['content']);
if(!$name['keywords']){
$name['keywords']=_webfig('keywords');
}
if(!$name['description']){
$name['description']=_substr(preg_replace("/(<([^<]+)>| | |>|'|"|&|<|\n)/is","",$name['content']),120);
}
$name['update_time'] = date("Y-m-d H:i:s",$name['update_time']);