php框架之phalcon
原创
©著作权归作者所有:来自51CTO博客作者zlixing的原创作品,请联系作者获取转载授权,否则将追究法律责任
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:\xampp\htdocs\phalcon-devtools');
// if (!file_exists(CPHALCON_DIR)) {
// throw new Exception("CPHALCON directory does not exist");
// }
//需要将文件的目录改成开发包的目录地址
3) 生成phalcon语法文件
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: Phalcon\Di::$_default in E:\xampp\htdocs\dajiala_main\public\index.php:18 Stack trace: #0 [internal function]: Phalcon\Di->__construct() #1 E:\xampp\htdocs\dajiala_main\public\index.php(18): Phalcon\Di\FactoryDefault->__construct() #2 {main} Next Error: Access to undeclared static property: Phalcon\Di::$_default in E:\xampp\htdocs\dajiala_main\public\index.php:18 Stack trace: #0 [internal function]: Phalcon\Di->__construct() #1 E:\xampp\htdocs\dajiala_main\public\index.php(18): Phalcon\Di\FactoryDefault->__construct() #2 {main} thrown in E:\xampp\htdocs\dajiala_main\public\index.php on line 18
php扩展版本对应的有问题,一定要下载对应的版本https://github.com/phalcon/cphalcon