Hello World!
<?php echo 'Hello World!'; ?>
<?php class hello_world { public static function main () { echo 'Hello World!'; } } hello_world::main(); ?>
<?php class hello_world { public static function main () { echo 'Hello World!'; } public static function hello () { echo 'Hello CoreMVC!'; } } debug_backtrace() or hello_world::main(); ?>
<?php require_once 'hello_world.php'; hello_world::hello(); ?>
<?php /** * 导入(import) */ class_exists('core') or require_once 'core.php'; /** * 定义(define) */ class hello_world extends core { public static function index () { echo 'Hello World!'; } public static function hello () { echo 'Hello CoreMVC!'; } } /** * 执行(execute) */ hello_world::stub() and hello_world::main(); ?>
SetEnv core_config 1 SetEnv core_config_framework_enable 1
<?php /** * 导入(import) */ require_once 'core.php'; /** * 执行(execute) */ core::init(array( 'autoload_enable' => true, 'autoload_path' => 'modules', 'framework_enable' => true, 'framework_module' => '[go]|hello_world!(self)', 'framework_action' => '[do]|index', )); core::main(); ?>
<?php /** * 导入(import) */ require_once 'core.php'; /** * 执行(execute) */ core::init ('config.php'); core::main (); ?>
<?php return array( 'autoload_enable' => true, 'autoload_path' => 'modules', 'framework_enable' => true, 'framework_module' => '[go]|hello_world!(self)', 'framework_action' => '[do]|index', 'template_path' => 'templates', ); ?>
<?php /** * 定义(define) */ class hello_world extends core { public static function index () { $name = 'World'; self::view('hello_world.tpl',compact('name')); } public static function hello () { $name = 'CoreMVC'; self::view('hello_world.tpl',compact('name')); } } ?>
Hello <?php echo $name; ?>!
<?php /** * 导入(import) */ require_once 'core.php'; /** * 执行(execute) */ core::init('config.php'); core::main(); ?>
<?php return array( 'autoload_enable' => true, 'autoload_path' => 'modules', 'framework_enable' => true, 'framework_module' => '[go]|hello_world!(self)', 'framework_action' => '[do]|index', 'template_path' => 'templates', 'connect_username' => '******', 'connect_password' => '******', 'connect_dbname' => '******', ); ?>
<?php /** * 定义(define) */ class hello_world extends core { public static function index () { $detail = new self; $detail->id = 1; $detail->select(); self::view(__CLASS__.'.tpl',compact('detail')); } public static function hello () { $detail = self::selects(null,__CLASS__,array('name LIKE ?'=>'%MVC'),null,array('class'=>null)); self::view(__CLASS__.'.tpl',compact('detail')); } } ?>
Hello <?php echo $detail->name; ?>!
<?php /** * 导入(import) */ require_once 'CoreMVC.php'; /** * 执行(execute) */ CoreMVC::init('config.php'); CoreMVC::main(); ?>
<?php /** * 定义(define) */ class hello_world extends CoreMVC { public static function index () { $detail = new self; $detail->id = 1; $detail->select(); self::view(__CLASS__.'.tpl',compact('detail')); } public static function hello () { $detail = self::selects(null,__CLASS__,array('name LIKE ?'=>'%MVC'),null,array('class'=>null)); self::view(__CLASS__.'.tpl',compact('detail')); } } ?>
<?php /** * 执行(execute) */ if(!class_exists('CoreMVC')) { require_once 'core.php'; class CoreMVC extends core {} //PHP 5.2使用 //class_alias('core','CoreMVC'); //PHP 5.3使用 } ?>