<?php
class TrimPHP_Strings {
public $str;
public function Apply() {
return $this->str;
}
function __constructor($str) {
$this->str = $str;
}
}
function Strings($str) {
$obj = new TrimPHP_Strings($str);
return $obj;
}
?>
<?php
echo Strings("My String")->Apply();
?>
Run Code Online (Sandbox Code Playgroud)
我不明白为什么上面的代码不起作用?我希望它输出,My String但它只是输出一个空白页.