CakePHP: MySQLの正規表現検索
普通なら
select * from table where hoge regexp "fuga";
とかでhogeカラムにfugaの入った検索が出来ますがcakephpを使うと少し記法が異なります。
$conditions = array( "hoge REGEXP" => "fuga" ); $params = array( 'conditions' => $conditions, 'order' => 'id desc', ); $this->set('foos',$this->Foo->find('all',$params));
こんな感じでいけます。
- 作者: 滝下真玄
- 出版社/メーカー: 秀和システム
- 発売日: 2013/03
- メディア: 単行本
- クリック: 2回
- この商品を含むブログ (2件) を見る