2

我有两个控制器:
test.php

public function trackback()
{
    $this->load->library('trackback');
    $tb_data = array(
                 'ping_url'  => 'http://www.citest.com/addtrackback/receive/777',
                 'url'       => 'http://www.citest.com/test/trackback/',
                 'title'     => 'Заголовок',
                 'excerpt'   => 'Текст.',
                 'blog_name' => 'Название блога',
                 'charset'   => 'utf-8'
                 );

    if ( ! $this->trackback->send($tb_data))
    {
        echo $this->trackback->display_errors();
    }
    else
    {
        echo 'Trackback успешно отправлен!';
    }
} 

函数trackback()发送trackback信息

addtrackback.php

public function receive()
{
    $this->load->library('trackback');

    if ($this->uri->segment(3) == FALSE)
    {
        $this->trackback->send_error("Не указан ID записи ");
    }

    if ( ! $this->trackback->receive())
    {
        $this->trackback->send_error("Trackback содержит некорректные данные!");
    }

    $data = array(
                 'tb_id'      => '',
                 'entry_id'   => $this->uri->segment(3),
                 'url'        => $this->trackback->data('url'),
                 'title'      => $this->trackback->data('title'),
                 'excerpt'    => $this->trackback->data('excerpt'),
                 'blog_name'  => $this->trackback->data('blog_name'),
                 'tb_date'    => time(),
                 'ip_address' => $this->input->ip_address()
                 );

    $sql = $this->db->insert_string('trackbacks', $data);
    $this->db->query($sql);

    $this->trackback->send_success();
}

函数receive()获取trackback并将其写入数据库中名为“trackbacks”的表中。

但是当我尝试查看该页面时,会导致以下错误:

遇到未知错误。

是什么导致了这个错误?

4

1 回答 1

0

你是在引用库还是你所在的函数?if ( ! $this->trackback->send($tb_data))

尝试将其更改为类似

public function trackback(){
$this->load->library('trackbackLibrary');

您要完成什么,因为您似乎正在尝试为同一进程执行 if 语句。

if ($this->uri->segment(3) == FALSE)
{
    $this->trackback->send_error("Не указан ID записи ");
}

if ( ! $this->trackback->receive())
{
    $this->trackback->send_error("Trackback содержит некорректные данные!");
}

此外,检查您的 error_log 文件以查看其抛出的实际错误。/var/log或其他一些地方。取决于您的操作系统

于 2012-02-03T13:13:39.927 回答