Db :: Instance prestashop [英] Db::Instance prestashop
问题描述
我在php脚本中添加了config.inc.php以便访问提供的Db类.
I added config.inc.php inside my php script in order to access to Db class provided.
问题在于,当我从服务器启动脚本时,该脚本被重定向到网站prestashop,然后在html页面中看不到想要显示的内容.
The problem is that when I launch the script from the server, it redicted to the website prestashop and then I can't see what I want to echo in the html page.
更多,为了查看此行为,我犯了一个错误:什么也没显示,他重定向到prestashop网站.
More, I have made a error in order to see the behaviour: nothing is shown, he redirect to the prestashop website.
请帮助我.
推荐答案
已解决
经过大量测试后,解决方案非常简单.
After lots of tests, the soloution is very easy.
为了在 my_own_file.php 中使用Prestashop服务中的类,我们必须包含
In order to use class from Prestashop service in my_own_file.php, we have to include
-
位于配置目录内的
- config.inc.php 位于商店根目录的
- init.php
- config.inc.php located inside config directory
- init.php located at the root of the store
但是,要达到这两个目标, my_own_file.php 必须位于prestashop商店目录的根目录或内部.
But, to reach this two includes, my_own_file.php has to be at the root of the prestashop store directory or inside it.
原因是,要访问prestashop商店文件,该文件也必须是商店的一部分.否则,您将没有权限,并且服务器将加载index.php.
The reason is that, to access to prestashop store files, the file has to be part of the store also. Otherwise, you don't have the permission and your sever loads index.php .
这篇关于Db :: Instance prestashop的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!