its*_*zad 7 magento mage fatal-error
我想使用ajax调用PHP文件,其中PHP我将通过ajax调用下订单.但是当我使用该文件中的app/Mage.php时,它会抛出错误
require_once '../../../../../../../../../../app/Mage.php';
$customer = Mage::getModel('customer/customer');
Run Code Online (Sandbox Code Playgroud)
然后它说
致命错误:在第432行的app\Mage.php中的非对象上调用成员函数getModelInstance()
谁能帮帮我吗???
Dan*_*oof 39
您提出的解决方案并非最佳.您尚未初始化Magento,因此尚未加载模块XML,并且工厂模式不起作用.
只需使用:
Mage::init(); // 1.5+
Run Code Online (Sandbox Code Playgroud)
要么
Mage::app(); // (pretty much anything) below 1.5
Run Code Online (Sandbox Code Playgroud)
在使用getModel之前.