Yaf_Dispatcher::throwException

(Yaf >=1.0.0)

Yaf_Dispatcher::throwException锟斤拷锟斤拷/锟截憋拷锟届常锟阶筹拷

说锟斤拷

public Yaf_Dispatcher::throwException ([ bool $flag ] ) : Yaf_Dispatcher

锟斤拷锟斤拷锟斤拷拇锟斤拷锟斤拷锟斤拷锟绞憋拷颍锟斤拷锟�/锟截憋拷锟届常锟阶筹拷锟斤拷 锟斤拷锟斤拷锟斤拷锟斤拷时锟斤拷Yaf锟斤拷锟斤拷锟阶筹拷锟届常锟斤拷锟斤拷锟角达拷锟斤拷锟缴诧拷捉锟侥达拷锟斤拷

锟斤拷也锟斤拷锟斤拷使锟斤拷 application.dispatcher.throwException锟斤拷锟斤到锟斤拷同锟斤拷目锟侥★拷

锟斤拷锟斤拷

flag

bool

锟斤拷锟斤拷值

锟斤拷锟斤拷

Example #1 Yaf_Dispatcher::throwexception()example

<?php

$config 
= array(
    
'application' => array(
        
'directory' => dirname(__FILE__),
    ),
);
$app = new Yaf_Application($config);

$app->getDispatcher()->throwException(true);

try {
    
$app->run();
} catch (
Yaf_Exception $e) {
    
var_dump($e->getMessage());
}
?>

锟斤拷锟斤拷锟斤拷锟教碉拷锟斤拷锟斤拷锟斤拷锟斤拷冢锟�

string(59) "Could not find controller script /tmp/controllers/Index.php"

Example #2 Yaf_Dispatcher::throwexception()example

<?php

$config 
= array(
    
'application' => array(
        
'directory' => dirname(__FILE__),
    ),
);
$app = new Yaf_Application($config);

$app->getDispatcher()->throwException(false);

$app->run();
?>

锟斤拷锟斤拷锟斤拷锟教碉拷锟斤拷锟斤拷锟斤拷锟斤拷冢锟�

PHP Catchable fatal error:  Yaf_Application::run(): Could not find controller script /tmp/controllers/Index.php in /tmp/1.php on line 12

锟轿硷拷