如需启动其他函数请点击窗口右下角的 "切换URL" 更换 ...

// 输出简单的Hello World
public function Hello(){
    return "Hello LyApi";
}
// 实现缓存的写入和读取
public function Cache(){
    $cache = \APP\DI::FileCache('Demo');
    //设置缓存
    $cache->set('username','mrxzx');
    $cache->set('password','123456');
    //读取缓存
    $username = $cache->get('username');
    $password = $cache->get('password');
    //清除缓存
    $cache->clean();
    //返回数据
    return array(
        'username' => $username,
        'password' => $password
    );
}
// 简单的登录系统
public function Login(){
    //获取Get数据
    $username = \LyApi\core\request\Request::Get('username');
    $password = \LyApi\core\request\Request::Get('password');

    if($username != '' && $password != ''){
        if($username == 'admin' && $password == 'lyapi520'){
            return true;
        }else{
            return false;
        }
    }else{
        throw new \LyApi\core\error\ClientException('参数不完整',0);
    }
}
// 渲染一个Hello World标题
public function View(){
    throw new \LyApi\core\error\CustomException('

Hello LyApi - View

'); }
// 自定义 Code Message 等值
public function Custom(){
    return [
        "#code" => 233,
        "#msg" => 'Hello Custom Message',
        "data" => 'Hello LyApi - Custom'
    ];
}
可将代码直接复制到在线运行中执行。