在/app/code/core/Mage/ core/ Model/Abstract.php第225行调用成员函数loa


Call to a member function load() on boolean in /app/code/core/Mage/Core/Model/Abstract.php on line 225

阅读本教程http://alanstorm.com/magento_models_orm从最近3天开始工作,如果可以请帮忙

但是我得到这个错误:-

加载ID为1的博文致命错误:在/var/www/html/magento/app/code/core/mage/core/model/abstract .php第225行调用布尔值上的成员函数load()

/var/www/html/线上购物/app/代码/地方/Alanstormdotcom/博客/etc/config . xml

<config>    
<modules>
    <Alanstormdotcom_Weblog>
        <version>0.1.0</version>
    </Alanstormdotcom_Weblog>
</modules>
<frontend>
    <routers>
        <weblog>
            <use>standard</use>
            <args>
                <module>Alanstormdotcom_Weblog</module>
                <frontName>weblog</frontName>
            </args>
        </weblog>
    </routers>  
</frontend>
<global>
    <models>
        <weblog>
            <class>
                Alanstormdotcom_Weblog_Model
            </class>
            <resourceModel>
                weblog_mysql4
            </resourceModel>
        </weblog>
        <weblog_mysql4>
            <class>Alanstormdotcom_Weblog_Model_Mysql4</class>
            <entities>
                <blogpost>
                    <table>blog_posts</table>
                </blogpost>
            </entities>
        </weblog_mysql4>
    </models>
    <resources>
        <weblog_write>
            <connection>
                <use>core_write</use>
            </connection>
        </weblog_write>
        <weblog_read>
            <connection>
                <use>core_read</use>
            </connection>
        </weblog_read>
    </resources>
</global>

/var/www/html/线上购物/app/代码/地方/Alanstormdotcom/博客/控制器/IndexController.php

<?php class Alanstormdotcom_Weblog_IndexController extends Mage_Core_Controller_Front_Action {
public function testModelAction() {
    $params=$this->getRequest()->getParams();
    $blogpost=Mage::getModel('weblog/blogpost');
    echo("Loading the blogpost with an ID of ".$params['id']);
    $blogpost->load($params['id']);
    $data=$blogpost->getData();
    var_dump($data);
} } ?>

/var/www/html/线上购物/app/代码/地方/Alanstormdotcom/博客/模型/Mysql4 Blogpost.php

<?php
class Alanstormdotcom_Weblog_Model_Mysql4_Blogpost extends Mage_Core_Model_Mysql4_Abstract {
protected function _construct()
{
    $this->_init('weblog/blogpost', 'blogpost_id');
}   } ?>

/var/www/html/线上购物/app/代码/地方/Alanstormdotcom/博客/模型/Blogpost.php

<?php
class Alanstormdotcom_Weblog_Model_Blogpost extends Mage_Core_Model_Abstract{
protected function _construct(){
    $this->_init('weblog/blogpost');
} } ?>

试试这个

<config>    
<modules>
    <Alanstormdotcom_Weblog>
        <version>0.1.0</version>
    </Alanstormdotcom_Weblog>
</modules>
<frontend>
    <routers>
        <weblog>
            <use>standard</use>
            <args>
                <module>Alanstormdotcom_Weblog</module>
                <frontName>weblog</frontName>
            </args>
        </weblog>
    </routers>  
</frontend>
<global>
    <models>
        <weblog>
            <class>Alanstormdotcom_Weblog_Model</class>
            <resourceModel>weblog_mysql4</resourceModel>
        </weblog>
        <weblog_mysql4>
            <class>Alanstormdotcom_Weblog_Model_Mysql4</class>
            <entities>
                <blogpost>
                    <table>blog_posts</table>
                </blogpost>
            </entities>
        </weblog_mysql4>
    </models>
    <resources>
        <weblog_write>
            <connection>
                <use>core_write</use>
            </connection>
        </weblog_write>
        <weblog_read>
            <connection>
                <use>core_read</use>
            </connection>
        </weblog_read>
    </resources>
</global>

模型和资源模型应该在同一行