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

OO Php 的一个初级问题

WBOY
WBOYOriginal
2016-06-20 12:40:551074browse

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 少一个_

Statement:
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