Home > Backend Development > PHP Tutorial > 为何,父类方法会提前执行

为何,父类方法会提前执行

WBOY
Release: 2016-06-13 12:00:51
Original
887 people have browsed it

为什么,父类方法会提前执行。


------解决方案--------------------
parent::fuc() 即 luo::fuc() 中是 echo ....
并不是返回一个串
而 echo self::$name1 . '---------'.parent::fuc();
要等到 串组装完成后才会输出,自然你就感觉是提前执行了
------解决方案--------------------
父类的fuc方法改成这样:
public function fun(){
  return self::$name.....;
}
------解决方案--------------------
直接输出,除非你不要跑到这段代码。。。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template