PHP 构造不工作?
我有以下代码:
<?php
class Human()
{
function __construct()
{
echo "A human was born";
}
}
$Person1 = new Human();
?>
我试图让它打印出“一个人类诞生了”,但它只是没有它!
I have the following code:
<?php
class Human()
{
function __construct()
{
echo "A human was born";
}
}
$Person1 = new Human();
?>
I'm trying to get it to print out "A human was born", but it's just not having it!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
删除
class Human
后面的()
。Remove the
()
afterclass Human
.您的语法有错误,您应该将类声明为:
类名后面没有
()
。You have an error in your syntax, you should declare the class as:
Without the
()
after the name of the class.