Joomla 类别';JTable';找不到
我使用的是Joomla 2.5.11。我有一个php文件存储在/public_html/joomtest/components/com_jumi/files中,粘贴在下面。 我有一个PHP表单,它存储在相同的位置,即/public_html/joomtest/components/com_jumi/files 我希望PHP表单调用PHP脚本,以便在Joomla中创建一篇文章。但是每当调用PHP脚本时,我都会收到以下错误Joomla 类别';JTable';找不到,joomla,joomla2.5,joomla-jtable,Joomla,Joomla2.5,Joomla Jtable,我使用的是Joomla 2.5.11。我有一个php文件存储在/public_html/joomtest/components/com_jumi/files中,粘贴在下面。 我有一个PHP表单,它存储在相同的位置,即/public_html/joomtest/components/com_jumi/files 我希望PHP表单调用PHP脚本,以便在Joomla中创建一篇文章。但是每当调用PHP脚本时,我都会收到以下错误 Fatal error: Class 'JTable' not found
Fatal error: Class 'JTable' not found
Joomla抛出错误的那条线是
$table = JTable::getInstance('Content', 'JTable', array());
PHP脚本
<?php
$table = JTable::getInstance('Content', 'JTable', array());
$data = array(
'catid' => 8,
'title' => 'SOME TITLE',
'introtext' => 'SOME TEXT',
'fulltext' => 'SOME TEXT',
'state' => 0,
);
if (!$table->bind($data))
{
$this->setError($table->getError());
return false;
}
if (!$table->check())
{
$this->setError($table->getError());
return false;
}
if (!$table->store())
{
$this->setError($table->getError());
return false;
}
?>
</body>
</html>
但这又一次不起作用。请提供帮助。您需要定义要使用的表文件的路径。使用以下代码包含特定表。例如:
JTable::addIncludePath(JPATH_SITE.DS.'components'.DS.'com_content'.DS.'tables');
然后按如下方式调用您的表:
$con_table = JTable::getInstance('Content', 'JTable', array());
希望这能奏效。祝你好运
$con_table = JTable::getInstance('Content', 'JTable', array());