Home > Backend Development > PHP Tutorial > php framework - thinkPHP M layer ->alias('a') What is the significance?

php framework - thinkPHP M layer ->alias('a') What is the significance?

WBOY
Release: 2016-07-06 13:53:32
Original
1407 people have browsed it

<code>$use=D('classone');
$db=$use->alias('a')->select();</code>
Copy after login
Copy after login

If in SQL, use SELECT b.id , b.name ,t.id FROM book as b , type as t ;

It makes sense to have an alias like this, here is ->alias('a') What is the purpose of giving an alias?

Reply content:

<code>$use=D('classone');
$db=$use->alias('a')->select();</code>
Copy after login
Copy after login

If in SQL, use SELECT b.id , b.name ,t.id FROM book as b , type as t ;

It makes sense to have an alias like this, here is ->alias('a') What is the purpose of giving an alias?

That’s what it means. .
http://www.kancloud.cn/manual/thinkphp/1737

The alias is used to represent a certain field in a certain table more concisely when JOIN tables are used. It can be used but not used

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