简体   繁体   English

在php中调用函数,请帮忙

[英]call function in php, little help please

How can I call a function like below: 我如何调用如下函数:

 $display_table="<table><tr><td>FUNCTION_CALL_HERE();</td></tr></table>";

I have tried brackets and all, but the function wont get called... 我已经尝试了括号和所有括号,但是该函数不会被调用...

How should I make this work? 我应该如何做这项工作? (syntax problems I think) (我认为语法问题)

Thanks 谢谢

is there a reason you cannot use string concatenation? 有不能使用字符串连接的原因吗? Assuming the output of FUNCTION_CALL_HERE is a string. 假设FUNCTION_CALL_HERE的输出是一个字符串。

$display_table="<table><tr><td>" . FUNCTION_CALL_HERE() . "</td></tr></table>";
 $display_table="<table><tr><td>" . FUNCTION_CALL_HERE() . "</td></tr></table>";

Alternatively: 或者:

$display_table="<table><tr><td>{FUNCTION_CALL_HERE()}</td></tr></table>";

Actually should be: 实际上应该是:

<?php

function asdf() {
return 'this is my string';
}
$f= 'asdf';

echo "Hello {$f()}\n";

?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM