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();?>
function __construct($param){
echo "Constructor called with parameter ".$param."
";
}
你的 construct 少一个_
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号