Rumah >pembangunan bahagian belakang >tutorial php >ThinkPHP视图模型指定数据库无效?
<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>
$connection
能正常操作指定数据库<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>
$connection
能正常操作指定数据库
没用过,,路过