magento:无法通过网址访问已安装的扩展文件夹
我在 magento 中创建了一个扩展;扩展名基本上是一个 php 文件。它应该是这样工作的:它包含 mage.php 文件并获取商店的内容并写入 xml 文件。现在这个 XML 文件需要由另一个脚本通过 Web 访问和读取。问题是安装的 magento 扩展文件夹无法通过网络访问。
/app/code/community/[公司名称]/[包名称]
但我知道当我的文件位于 magento 安装的根文件夹时,它可以工作。 1. 如何创建扩展以使其安装在根文件夹或任何可通过网络访问的文件夹中?
谢谢。
I have created an extension in magento; The extension is basically one php file. this is how it is supposed to work: It includes the mage.php file and gets contents of a store and writes an xml file. Now this XML file needs to be accessed and read by another script through the web. The problem is that the installed magento extensions folder is not web accessible.
/app/code/community/[CompanyName]/[PackageName]
But I know that when my file is located at the root folder of a magento installation, it works.
1. How can i create the extension to make it be installed in the root folder or any folder which is web accessible?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将文件放在您喜欢的任何位置(如果 Magento 的其他部分不需要使用它们)。听起来您没有编写模块,因此不需要位于
app/code/
文件夹中。打包扩展程序时,请记住使用相对于根文件夹的内容目标“其他可通过网络访问的文件”。更传统的方法是编写带有控制器的模块。它将是用 XML 内容响应请求的控制器。通过利用 Magento 的 URL 重写,URL 可以是任何内容。这样,XML 就可以按需生成,因此它始终是准确的。出于安全原因,某些服务器不一定具有根文件夹的完全写入权限。
You can put your files anywhere you like if they don't have to be available to the rest of Magento. It sounds like you are not writing a module so does not need to be in the
app/code/
folder. When packaging your extension remember to use the content target "Other web accessible file" which is relative to the root folder.A more conventional way is to write a module with a controller. It will be the controller that responds to requests with XML content. The URL can then be anything by leveraging Magento's URL rewrites. This way the XML can be generated on demand so it is always accurate. Some servers won't necessarily have full write access to the root folder for security reasons.