我将 1-10 个参数传递给一个函数,然后我希望该函数为每个参数自行运行,但返回以前的数据和新数据。
所以我有一个如下功能:
function scrape_google_result_source($link,$link2) //$link is "test" $link2 is "test2"
{
$html = $link;
$cache = $html; //this is my first return
$html = $link2;
$cache = $cache . $html; //this is my first and second return
return $cache; //now I am returning it so it will be "testtest2"
}
如果我手动传入 $link1 和 $link2 然后对其进行编码以与它们一起使用,则此方法有效,我希望它为传入的每个参数自行运行,然后设置“$cache .= new result”,然后我将返回结果所有的争论都过去了。
可悲的是,我没有除此之外的代码,因为我不确定从哪里开始,我确实找到了func_num_args();
可能工作的 php 函数?非常感谢任何帮助。
谢谢,西蒙