public function endpage($ajaxmode = false){ $this->trigger(self::event_end_page); $content = ob_get_clean(); echo strtr($content, [ self::ph_head => $this->renderheadhtml(),//返回字符串 self::ph_body_begin => $this->renderbodybeginhtml(),//返回字符串 self::ph_body_end => $this->renderbodyendhtml($ajaxmode),//返回字符串 ]); $this->clear();}
几个self变量的值都是形如:
const ph_head = '';
回复内容: 在yii2源码文件vendor/yiisoft/yii2/web/view.php中看到这个方法,里面用到strstr函数,strstr这样用不是有问题吗???求解!
public function endpage($ajaxmode = false){ $this->trigger(self::event_end_page); $content = ob_get_clean(); echo strtr($content, [ self::ph_head => $this->renderheadhtml(),//返回字符串 self::ph_body_begin => $this->renderbodybeginhtml(),//返回字符串 self::ph_body_end => $this->renderbodyendhtml($ajaxmode),//返回字符串 ]); $this->clear();}
几个self变量的值都是形如:
const ph_head = '';
看仔细了,人家写的是
http://php.net/strtr
这个,而不是你问的
http://php.net/strstr
这个
