【发布时间】:2011-06-08 11:07:21
【问题描述】:
我制作了一个将文件添加到 zip 的脚本(经过大量解析等),我有这个功能:
function _add_file($command)
{
if (!isset($command["source"]) || !isset($command["dest"])) {
return;
}
if (!get_file_info("files/".$command["source"])) {
return;
}
$zip->addFile("files/".$command["source"], $command["destination"]);
}
它给出了一个错误,因为 $zip 没有在 _add_file 中定义。如何让 _add_file 访问调用它的函数中定义的 $zip(没有_add_file($command, $zip))?
【问题讨论】:
标签: php codeigniter variables scope parent