<?php
class hello {
public function echo() {
return 'omg';
}
}
function world() {
global $a;
$a = new hello();
}
world();
$a->echo();
我该如何实现这个想法?可能吗?
这是你所期望的吗?在我看来,请不要尝试使用 echo 作为函数名称。
class hello{
public function display()
{ return 'omg';
}
}
function world()
{
global $a;
$a = new hello();
}
world();
echo $a->display();