操作对象(Objects Manipulation)
常用函数列表
函数名 |
---|
phalcon_isset_property |
phalcon_read_property |
phalcon_update_property |
实例化框架中的类很容易:
- <?php
- $route = new Phalcon\Mvc\Router\Route("#^/([a-zA-Z0-9\\_]+)[/]{0,1}$#");
Moreover, if is not a Phalcon class then objects must then initialized as follows:
读写属性(Reading/Writing Properties)
- // Create a stdClass object
- object_init(&employee);
- // $employee->name = "Sonny"
- phalcon_update_property_string(&employee, SL("name"), "Sonny");
- // $employee->age = 23
- phalcon_update_property_long(&employee, SL("age"), 23);
- // Read the "name" property $name = $employee->name
- phalcon_read_property(&name, &employee, SL("name"), PH_NOISY_CC);
Assigning other zvals to properties:
- ZVAL_STRING(&language, "English");
- ZVAL_STRING(&property, "language");
- object_init(&employee);
- // $employee->$property = $language
- phalcon_update_property_zval_zval(&employee, &property, &language);
- // $user_language = $employee->$property
- phalcon_read_property_zval(&user_language, &employee, &property, PH_NOISY_CC);
Reading/Writing static properties: