Home > Backend Development > PHP Tutorial > OO Php 的一个初级问题

OO Php 的一个初级问题

WBOY
Release: 2016-06-20 12:40:55
Original
1108 people have browsed it

Hello PHPers,

在家自学“Php and my sql web dev 4th edition”的时候,遇到了困难。看到OO php 自己就照葫芦画瓢抄写了书中代码,放在本机的WampServer看效果。结果却是没效果。

希望潜水的php高手们,能指导一下。 谢谢。

<?phpclass classname{	function _construct($param)	{				echo "Constructor called with parameter ".$param."<br />";			}		}$a = new classname("First");$b = new classname("Second");$c = new classname();?>
Copy after login



回复讨论(解决方案)

function __construct($param){       
        echo "Constructor called with parameter ".$param."
";       
    }
你的 construct 少一个_

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