php的c扩展框架 phalcon 的简单使用
Posted 79 months ago php linux phalcon
Phalcon 是开源、全功能栈、使用 C 扩展编写、针对高性能优化的php框架
生成控制器
phalcon create-controller --name index2
基本配置
[database]
adapter = Mysql
host = "127.0.0.1:port"
username = "root"
password = "root"
dbname = "tests"
[phalcon]
controllersDir = "../app/controllers/"
modelsDir = "../app/models/"
viewsDir = "../app/views/"
baseUri = "/store/"
生成模型
phalcon model products
- –name=s Table name 表名
- –schema=s Name of the schema. [optional] schema名
- –namespace=s Model’s namespace [optional] 模型命名空间
- –get-set Attributes will be protected and have setters/getters. [optional] 设置字段访问属性为私有 并添加setters/getters方法
- –extends=s Model extends the class name supplied [optional] 指定扩展类名
- –excludefields=l Excludes fields defined in a comma separated list [optional]
- –doc Helps to improve code completion on IDEs [optional] 辅助IDE的自动完成功能
- –directory=s Base path on which project will be created [optional] 项目的根目录
- –force Rewrite the model. [optional] 重写模型
- –trace Shows the trace of the framework in case of exception. [optional] 出错时显示框架trace信息
- –mapcolumn Get some code for map columns. [optional] 生成字映射的代码
- –abstract Abstract Model [optional] 抽象模型
生成简单的curd
phalcon scaffold --table-name products
开启webtools
phalcon webtools enable/disable(开启关闭)