开发者

set a function equal to a variable so i can do this($var)

I have a function the_search() that ju开发者_C百科st echoes what people searched for.

I want to put that in to another function, get_data($var) to get some data.

How can I set the_search(); equal to some $var so that I can do the following:

$thing = get_data('$var');


a) You could change the_search not to echo the data, but to return it.

b) You could use Output Buffering:

ob_start();
the_search();
$var = ob_get_clean();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜