Asf_Sg::$inputs

相当于操作一个PHP多维数组, 默认有三个子元素 $inputs['get'] = $_GET, $inputs['post'] = $_POST, $inputs['cookie'] = $_COOKIE


Description

public static $inputs = array('get' => array(), 'post' => array(), 'cookie' => array())

Return Values

操作不存在的 key 会抛出 PHP Warning

Examples

Example #1

<?php

/**
 * asf.ctype_id=0
 * asf.action_suffix=1
 * asf.use_namespace=0
 */

class IndexService
{
    public function indexAction()
    {
        var_dump(Asf_Sg::$inputs);
        var_dump(Asf_Sg::$inputs['get']);
        var_dump(Asf_Sg::$inputs['post']);
        var_dump(Asf_Sg::$inputs['cookie']);
    }
}

$configs = array(
    'asf' => array(
        'root_path'  => MODULE_PATH,
    )
);

$handle = new Asf_Application($configs);
$handle->run()

Example #2

<?php

/**
 * asf.ctype_id=0
 * asf.action_suffix=1
 * asf.use_namespace=0
 */

class IndexService
{
    public function indexAction()
    {
    }
}

class Bootstrap
{
    public function _initHow()
    {
        Asf_Sg::$inputs['user'] = 'one';
    }

    public function _initAre()
    {
        var_dump(Asf_Sg::$inputs['user']);
        Asf_Sg::$inputs['user'] = 'two';
    }

    public function _initYou()
    {
        var_dump(Asf_Sg::$inputs['user']);
    }
}

$configs = array(
    'asf' => array(
        'root_path'  => __DIR__,
    )
);

$handle = new Asf_Application($configs);
$handle->bootstrap()->run();