操作对象(Objects Manipulation)

    常用函数列表

    函数名
    phalcon_isset_property
    phalcon_read_property
    phalcon_update_property

    实例化框架中的类很容易:

    1. <?php
    2.  
    3. $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)

    1. // Create a stdClass object
    2. object_init(&employee);
    3. // $employee->name = "Sonny"
    4. phalcon_update_property_string(&employee, SL("name"), "Sonny");
    5.  
    6. // $employee->age = 23
    7. phalcon_update_property_long(&employee, SL("age"), 23);
    8.  
    9. // Read the "name" property $name = $employee->name
    10. phalcon_read_property(&name, &employee, SL("name"), PH_NOISY_CC);

    Assigning other zvals to properties:

    1. ZVAL_STRING(&language, "English");
    2. ZVAL_STRING(&property, "language");
    3.  
    4. object_init(&employee);
    5.  
    6. // $employee->$property = $language
    7. phalcon_update_property_zval_zval(&employee, &property, &language);
    8.  
    9. // $user_language = $employee->$property
    10. phalcon_read_property_zval(&user_language, &employee, &property, PH_NOISY_CC);

    Reading/Writing static properties: