$where="name='Joe' AND status='boss' OR status='active'";$this->db->where($where);// $this->db->where() にはオプションで第3の引数を渡すこともできます。// FALSE を渡した場合、CodeIgniter はフィールド名やテーブル名を守りません。$this->db->where('MATCH (field) AGAINST ("value")',NULL,FALSE);
# Message: Class 'Symfony\Component\Dotenv\Dotenv' not found エラー発生
An uncaught Exception was encountered
Type: Error
Message: Class 'Symfony\Component\Dotenv\Dotenv' not found
Filename: /Users/t/Documents/www.com/application/config/hooks.php
windows では動いてくれてたけど、mac では動かない!あるあるパターンですけど、dotenv not found って composer install 忘れたかなあと思ったりしますが、install コマンド走らせても特に解消しない
composer update かけてみたら原因がわかりました。
$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- symfony/dotenv v5.0.4 requires php ^7.2.5 -> your PHP version (7.1.23) does not satisfy that requirement.
- symfony/dotenv v5.0.3 requires php ^7.2.5 -> your PHP version (7.1.23) does not satisfy that requirement.
- symfony/dotenv v5.0.2 requires php ^7.2.5 -> your PHP version (7.1.23) does not satisfy that requirement.
- symfony/dotenv v5.0.1 requires php ^7.2.5 -> your PHP version (7.1.23) does not satisfy that requirement.
- symfony/dotenv v5.0.0 requires php ^7.2.5 -> your PHP version (7.1.23) does not satisfy that requirement.
- Installation request for symfony/dotenv ^5.0 -> satisfiable by symfony/dotenv[v5.0.0, v5.0.1, v5.0.2, v5.0.3, v5.0.4].
<?phpdefined('BASEPATH')orexit('No direct script access allowed');useSymfony\Component\Dotenv\Dotenv;$hook['pre_controller']=array('class'=>'MyClass','function'=>'Myfunction','filename'=>'Myclass.php','filepath'=>'hooks','params'=>array('beer','wine','snacks'));$hook['pre_system']=function(){try{$dotenv=newDotenv();$dotenv->load(APPPATH.'../.env');}catch(Exception$e){//}functionenv(string$key,$default=null){$value=$_ENV[$key];return$value??$default;}};