Laravel 5中的Mysql select(绑定属性)

时间:2015-06-21 14:01:13

标签: php mysql laravel-5

在Laravel 5中,是否可以进行如下查询:

$rank_name='atp';
DB::select("
   select a, ? as rank
   from table
   order by rank ", array($rank_name));

我的MySql服务器执行:

select a, 'atp' as rank from table order by rank; 

是否可以获得此查询:

select a, atp as rank from table order by rank; 

0 个答案:

没有答案