Magento:通过cronjob的php脚本删除斜杠

时间:2015-04-28 19:46:26

标签: php magento cron magento-1.7

我有一个Magento扩展程序,用于创建登录页面。这样可以正常工作,但登陆页面不会添加到站点地图中。 所以我创建了一个简单的PHP脚本,将url添加到站点地图中。 当我在Web浏览器中调用它时,此脚本运行良好。 我看到这些条目添加了:

<url>
  <loc>
    http://www.scrapwebshop.nl/merknaam/lavinia-stamps.html
  </loc>
  <lastmod>2015-02-23</lastmod>
  <changefreq>weekly</changefreq>
  <priority>0.8</priority>
</url>

这是预期的。 现在我已经创建了一个可以调用这个php脚本的cronjob。但现在网址中的斜线丢失了。 cronjon创建了这样的条目:

<url>
  <loc>
    http://www.scrapwebshop.nlmerknaamlavinia-stamps.html
  </loc>
  <lastmod>2015-02-23</lastmod>
  <changefreq>weekly</changefreq>
  <priority>0.8</priority>
</url>

我不知道为什么会这样。这是cron工作还是Magento的设置?

修改

这是我的cron命令:

/usr/bin/php -q /[..]/sitemap/generate_sitemap.php >/dev/null 2>&1

这是我的相关Magento代码:

$xml .= sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>',
                        htmlspecialchars($landingPage->getUrl()), ($landingPage->getUpdatedAt(false), "weekly", 0.8);

我打开现有的sitemap.xml 我找到了登陆页面列表并循环它们。 对于每个登录页面,我在xml字符串中添加一个条目。 最后,我将xml字符串添加到站点地图。 如上所述通过浏览器调用脚本工作正常,问题是通过cron作业调用它。

0 个答案:

没有答案