【发布时间】:2018-01-31 17:08:36
【问题描述】:
我正在尝试使用 php glob 制作一个小脚本,用于检索包含产品导入映射指令的配置文件。但我失败得很惨。
我现在拥有的:
echo "Shop type: " . $this->shopType . '<br />';
echo "Shop version: " . $this->shopVersion . '<br />';
echo "Glob search: config/mappings/" . $this->shopType . "_" . $this->shopVersion . ".php";
foreach (glob("config/mappings/" . $this->shopType . "_" . $this->shopVersion . ".php") as $filename) {
echo "$filename size " . filesize($filename) . "\n";
}
exit;
$this->shopType 代表应导入导出文件的店铺名称。例如。 ccvshop.$this->shopVersion代表店铺的版本,可以为不同版本的店铺类型编写不同的导入映射。
shopType 的值 = ccvshop.
shopVersion 的值 = 11.2。
这将使 glob 函数中的搜索字符串:
config/mappings/ccvshop_11.2.php.
不幸的是,我的结果是空的,我看不到我做错了什么。
任何帮助将不胜感激。
【问题讨论】:
标签: php file-get-contents glob