ThinkPHP view model specified database is invalid?

WBOY
Release: 2016-07-06 13:53:10
Original
982 people have browsed it

<code><?php

namespace Common\Model;

/**
 * 无法使用
 */
class MessageViewModel extends \Think\Model\ViewModel {

    protected $connection = "DB_CONF_MAN";

    protected $viewFields = array(
        "Message" => array(
            "*",
            "_type" => "LEFT",
        ),
        "MessageText" => array(
            "title",
            "content",
            "_on" => "Message.message_text_id = MessageText.id",
        )
    );

}
</code>
Copy after login
Copy after login
ps: Ordinary model specification$connectioncan operate the specified database normally

Reply content:

<code><?php

namespace Common\Model;

/**
 * 无法使用
 */
class MessageViewModel extends \Think\Model\ViewModel {

    protected $connection = "DB_CONF_MAN";

    protected $viewFields = array(
        "Message" => array(
            "*",
            "_type" => "LEFT",
        ),
        "MessageText" => array(
            "title",
            "content",
            "_on" => "Message.message_text_id = MessageText.id",
        )
    );

}
</code>
Copy after login
Copy after login
ps: Ordinary model specification$connectioncan operate the specified database normally

Never used it, passing by

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template