php框架之phalcon

   

 

 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语法文件

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: 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

 

posted @ 2019-04-28 15:28  X-Wolf  阅读(778)  评论(0编辑  收藏  举报