【发布时间】:2015-07-01 05:11:24
【问题描述】:
嗨,我有一个我不明白的问题,请有人可以帮助我。 我在 1.8.1 我在 app->code->local->Mycompany 中有一个模块
- 我的坎帕尼
- 测试模型
- 等
- config.xml
- 型号
- FirstModel.php
- 等
- 测试模型
config.xml 中的代码
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_TestModel>
<version>0.1.0</version>
</Mycompany_TestModel>
</modules>
<global>
<models>
<TestModel>
<class>Mycompany_TestModel_Model</class>
</TestModel>
</models>
</global>
</config>
FirstModel.php 中的代码
class Mycompany_TestModel_Model_FirstModel extends Mage_Core_Model_Abstract {
public function output()
{
echo "get";
}
}
当我使用时
Mage::getModel('TestModel/FirstModel')
magento 无法加载类。
我测试过,它在我的本地机器上运行。
请帮忙。
另外。我也试过:
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_TestModel>
<version>0.1.0</version>
</Mycompany_TestModel>
</modules>
<global>
<models>
<testmodel> /* instead of <TestModel> */
<class>Mycompany_TestModel_Model</class>
</testmodel>
</models>
</global>
</config>
我还是什么都进不去
Mage::getModel('testmodel/FirstModel')
非常感谢。
【问题讨论】:
-
我确实在模块文件夹中添加了一个配置文件。
-
@Manashvibirla 你说的桌子是什么意思?这是 whloe 模块。只有一个测试模型。
标签: magento magento-1.8