怎么在magento中执行命令
文章目录
项目中有需求需要执行完指定代码进行重新索引和刷新缓存,Google找了一堆文章,
最多的就是这个,我就用
$command = ' php bin/magento indexer:reindex';
shell_exec($command);结果提示错误Could not open input file: bin/magento
查了一下这个是因为目录不对,然后我就在这个基础上改进了如下就解决了
$command = 'cd '.$this->rootPath.' && php bin/magento indexer:reindex';
shell_exec($command);
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论