关于 Magento 模型和 ORM 基础知识的教程中的模型在 Magento 1.5.0 中不起作用
我也一直在关注这个关于 Magento 模型和 ORM 基础知识的教程。我正在使用 Magento 版本 1.5.0,当我测试模型时发现它是否专门用于打印此代码中的对象,我得到的只是一张空白的白页。
public function testModelAction() {
$blogpost = Mage::getModel('weblog/blogpost');
echo get_class($blogpost);
}
我查看了系统日志,发现了这些错误
2011-02-16T04:18:27+00:00 ERR (3): Warning: include(Alanstormdotcom\Weblog\Model\Blogpost.php) [function.include]: failed to open stream: No such file or directory in E:\xampp\htdocs\magento\lib\Varien\Autoload.php on line 94
2011-02-16T04:18:27+00:00 ERR (3): Warning: include() [function.include]: Failed opening 'Alanstormdotcom\Weblog\Model\Blogpost.php' for inclusion (include_path='E:\xampp\htdocs\magento\app\code\local;E:\xampp\htdocs\magento\app\code\community;E:\xampp\htdocs\magento\app\code\core;E:\xampp\htdocs\magento\lib;.;E:\xampp\php\PEAR') in E:\xampp\htdocs\magento\lib\Varien\Autoload.php on line 94
2011-02-16T04:18:27+00:00 ERR (3): Warning: get_class() expects parameter 1 to be object, boolean given in E:\xampp\htdocs\magento\app\code\local\Alanstormdotcom\Weblog\controllers\IndexController.php on line 6
希望你能帮助我解决这个问题..
谢谢..
I've been following this tutorial about Magento's Model and ORM basics too. I'm using Magento Version 1.5.0, and when i came across on testing the model if it works specially in printing the object in this code, all i get is a blank white page.
public function testModelAction() {
$blogpost = Mage::getModel('weblog/blogpost');
echo get_class($blogpost);
}
I went to see the system log and i get these errors
2011-02-16T04:18:27+00:00 ERR (3): Warning: include(Alanstormdotcom\Weblog\Model\Blogpost.php) [function.include]: failed to open stream: No such file or directory in E:\xampp\htdocs\magento\lib\Varien\Autoload.php on line 94
2011-02-16T04:18:27+00:00 ERR (3): Warning: include() [function.include]: Failed opening 'Alanstormdotcom\Weblog\Model\Blogpost.php' for inclusion (include_path='E:\xampp\htdocs\magento\app\code\local;E:\xampp\htdocs\magento\app\code\community;E:\xampp\htdocs\magento\app\code\core;E:\xampp\htdocs\magento\lib;.;E:\xampp\php\PEAR') in E:\xampp\htdocs\magento\lib\Varien\Autoload.php on line 94
2011-02-16T04:18:27+00:00 ERR (3): Warning: get_class() expects parameter 1 to be object, boolean given in E:\xampp\htdocs\magento\app\code\local\Alanstormdotcom\Weblog\controllers\IndexController.php on line 6
Hope you can help me in resolving this problem..
Thank you..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
什么样的混蛋会写出不起作用的教程?!
查看错误消息,
Magento 告诉您找不到您的模型文件。您是否创建了名为 Blogpost.php 的模型?它在正确的文件夹中吗?它应该位于
如果 Magento 找不到它,则意味着它不存在。如果它在那里,则意味着有人对您的包含路径进行了混淆。
What sort of bum writes a tutorial that doesn't work?!
Take a look at your error message
Magento is telling you it can't find your model file. Have you created the model named Blogpost.php? Is it in the right folder? It should be at
If Magento can't find it, that means it's not there. If it is there, than means someone's monkeied with your include path.
这是 Alanstormdotcom\Weblog\Model\Blogspot.php
这是 config.xml
this the Alanstormdotcom\Weblog\Model\Blogspot.php
this is the config.xml