Php Heredoc与特殊弦
如何添加这种函数Php Heredoc与特殊弦,php,heredoc,Php,Heredoc,如何添加这种函数 __("go") 内部: <<<_END 我想你可以用魔法来解决这个问题: class Magic { public function __call($method, $args) { // would seriously recommend checking whether `$method` exists :) return call_user_func_array($method, $args); }
__("go")
内部:
<<<_END
我想你可以用魔法来解决这个问题:
class Magic
{
public function __call($method, $args) {
// would seriously recommend checking whether `$method` exists :)
return call_user_func_array($method, $args);
}
}
$magic = new Magic;
$str = <<<EOM
Hello this should give the {$magic->time()}.
EOM;
类魔法
{
公共函数调用($method,$args){
//建议认真检查“$method”是否存在:)
返回调用用户函数数组($method,$args);
}
}
$magic=新魔术;
$str=