Home >Backend Development >PHP Tutorial >ThinkPHP view model specified database is invalid?

ThinkPHP view model specified database is invalid?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-06 13:53:101030browse

<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>
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>
ps: Ordinary model specification$connectioncan operate the specified database normally

Never used it, passing by

Statement:
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