1.开发助手
1) 下载
git clone https://github.com/phalcon/cphalcon.git git clone https://github.com/phalcon/phalcon-devtools.git
2)修改目录下的ide/gen-stubs.php文件
// define('CPHALCON_DIR' , '/Users/micate/Code/cphalcon/ext/php'); define('CPHALCON_DIR' , 'E:xampphtdocsphalcon-devtools'); // if (!file_exists(CPHALCON_DIR)) { // throw new Exception("CPHALCON directory does not exist"); // } //需要将文件的目录改成开发包的目录地址
3) 生成phalcon语法文件
php gen-stub.php
4)配置PHPstorm支持phalcon语法(指定包的地址即可)
常见错误汇总:
1. Scanner: Unknown opcode 58
$condition = 'username = :username:'; $params = [ 'username' => $username, ]; $row = SysUser::findFirst( [ $condition, 'bind' => $params ] ); //执行数据查询的时候, 错误的原因是 绑定的参数 :username 注意两点都有冒号
2.
Fatal error: Uncaught Error: Access to undeclared static property: PhalconDi::$_default in E:xampphtdocsdajiala_mainpublicindex.php:18 Stack trace: #0 [internal function]: PhalconDi->__construct() #1 E:xampphtdocsdajiala_mainpublicindex.php(18): PhalconDiFactoryDefault->__construct() #2 {main} Next Error: Access to undeclared static property: PhalconDi::$_default in E:xampphtdocsdajiala_mainpublicindex.php:18 Stack trace: #0 [internal function]: PhalconDi->__construct() #1 E:xampphtdocsdajiala_mainpublicindex.php(18): PhalconDiFactoryDefault->__construct() #2 {main} thrown in E:xampphtdocsdajiala_mainpublicindex.php on line 18
php扩展版本对应的有问题,一定要下载对应的版本https://github.com/phalcon/cphalcon