thinkPHP的数据库操作如何用alias

WBOY
Release: 2016-06-13 11:52:41
Original
1074 people have browsed it

thinkPHP的数据库操作怎么用alias?
连贯操作  作用                                      支持的参数类型 
alias        用于给当前数据表定义别名      字符串 

求助thinkPHP的操作方式alias怎么用,不要原生态的sql写法
thinkPHP的开发文档里面介绍是不是漏了alias的介绍?我的是thinkPHP3.1.2的开发文档
------解决方案--------------------
请遵守CSDN用户行为准则,不得违反国家法律法规。
------解决方案--------------------
http://www.thinkphp.cn/simple/quickstart_4.html
------解决方案--------------------

alias用于设置当前数据表的别名,便于使用其他的连贯操作例如join方法等。<br />示例:<br />$Model = M('User');<br />$Model->alias('a')->join('__DEPT__ b ON b.user_id= a.id')->select();<br />最终生成的SQL语句类似于:<br />SELECT * FROM think_user a INNER JOIN think_dept b ON b.user_id= a.id
Copy after login
http://document.thinkphp.cn/manual_3_2.html#alias

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!