コード例 #1
0
ファイル: Index.php プロジェクト: lifenglsf/yafdemo
 public function testAction()
 {
     $response = new Yaf_Response_Http();
     $response->setBody('HelloWorld');
     echo $response;
 }
コード例 #2
0
ファイル: index.php プロジェクト: hillstill/soohyaf
define("APP_PATH", dirname(__DIR__));
/* 指向public的上一级 */
if (!defined('SOOH_INDEX_FILE')) {
    define('SOOH_INDEX_FILE', 'index.php');
}
define('SOOH_ROUTE_VAR', '__');
error_log("-------------------------------------------------------tart:route=" . $_GET['__'] . " cmd=" . $_GET['cmd'] . " pid=" . getmypid());
include dirname(__DIR__) . '/conf/globals.php';
$ini = \Sooh\Base\Ini::getInstance();
$app = new Yaf_Application(APP_PATH . "/conf/application.ini");
$dispatcher = $app->getDispatcher();
if (!empty($reqeustReal)) {
    $dispatcher->setRequest($reqeustReal);
}
$view = \SoohYaf\SoohPlugin::initYafBySooh($dispatcher);
$dispatcher->returnResponse(TRUE);
try {
    $response = $app->run();
} catch (\ErrorException $e) {
    $view->assign('code', $e->getCode());
    $view->assign('msg', $e->getMessage());
    error_log("Error Caught at index.php:" . $e->getMessage() . "\n" . \Sooh\DB\Broker::lastCmd() . "\n" . $e->getTraceAsString() . "\n");
    $response = new Yaf_Response_Http();
    $response->setBody($view->render('ctrl/action.phtml'));
}
if ($ini->viewRenderType() === 'json') {
    header('Content-type: application/json');
}
$response->response();
\Sooh\Base\Ini::registerShutdown(null, null);
error_log("====================================================================end:route=" . $_GET['__'] . " cmd=" . $_GET['cmd'] . " pid=" . getmypid());
コード例 #3
0
ファイル: HttpTest.php プロジェクト: ligboy/yaf-phpport
 public function testCase026()
 {
     $response = new Yaf_Response_Http();
     $response->setBody("ell")->appendBody("o")->prependBody("H");
     $this->assertEquals('Hello', $response->getBody());
 }