日本搞逼视频_黄色一级片免费在线观看_色99久久_性明星video另类hd_欧美77_综合在线视频

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > php框架 > ZendFramework > Zend Framework教程-Zend的Model-簡單舉例

Zend Framework教程-Zend的Model-簡單舉例

來源:程序員人生   發布時間:2014-01-10 17:31:02 閱讀次數:3844次

附一個簡單粗俗的例子。只是大概說明了用法:如果要深究,可以自己跟蹤源碼了解。

model_demo1

 

│  .project│  .buildpath│  .zfproject.xml│├─.settings│      org.eclipse.php.core.prefs│      .jsdtscope│      org.eclipse.wst.jsdt.ui.superType.name│      org.eclipse.wst.jsdt.ui.superType.container│├─application│  │  Bootstrap.php│  ││  ├─configs│  │      application.ini│  ││  ├─controllers│  │      IndexController.php│  │      ErrorController.php│  ││  ├─models│  │      Test.php│  │      ModelTest.php│  ││  └─views│      ├─scripts│      │  ├─index│      │  │      index.phtml│      │  ││      │  └─error│      │          error.phtml│      ││      └─helpers├─docs│      README.txt│├─library│  ├─app│  │      Test.php│  ││  ├─myApp│  │      Test.php│  ││  ├─Zend│  │      Test.php│  ││  ├─AppTest│  │      Test.php│  ││  └─AppTest2│          Test.php│├─public│      index.php│      .htaccess│└─tests    │  phpunit.xml    │  bootstrap.php    │    ├─application    │  └─controllers    │          IndexControllerTest.php    │    └─library


如下是從上到下,每一個文件的源碼,不再詳細說明:

/model_demo1/application/configs/application.ini

[production]phpSettings.display_startup_errors = 1phpSettings.display_errors = 1includePaths.library = APPLICATION_PATH "/../library"bootstrap.path = APPLICATION_PATH "/Bootstrap.php"bootstrap.class = "Bootstrap"appnamespace = "Application"autoloadernamespaces.app = "App_"autoloadernamespaces.my = "MyApp_" resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"resources.frontController.params.displayExceptions = 1[staging : production][testing : production]phpSettings.display_startup_errors = 1phpSettings.display_errors = 1[development : production]phpSettings.display_startup_errors = 1phpSettings.display_errors = 1resources.frontController.params.displayExceptions = 1

/model_demo1/application/controllers/IndexController.php

<?phpclass IndexController extends Zend_Controller_Action {		public function init() {		/* Initialize action controller here */	}		public function indexAction() {		var_dump ( Application_Model_Test::getUserInfo () );		App_Test::echoAppTest ();		MyApp_Test::echoAMyAppTest ();		Zend_Test::echoZendTest ();		AppTest_Test::echoAppTestTest ();						$auto_loader = Zend_Loader_Autoloader::getInstance();		$resourceLoader = new Zend_Loader_Autoloader_Resource(array(				'basePath' => '/www/model_demo1/application',				'namespace' => '',				'resourceTypes' => array(						'model' => array(								'path' => 'models',								'namespace' => 'Model'						)				)		)		);		$auto_loader->pushAutoloader($resourceLoader);		$auto_loader->registerNamespace(array('AppTest2_'));		AppTest2_Test::echoAppTest2Test();		Model_ModelTest::echoModelModelTest();		exit ();	}}

/model_demo1/application/models/ModelTest.php

 

<?phpclass Model_ModelTest{	static function echoModelModelTest(){		echo 'Model_ModelTest<br/>';	}}

/model_demo1/application/models/Test.php 


<?phpclass Application_Model_Test {		static public function getUserInfo() {				return array (				'user_name' => '張三',				'user_gender' => '男' 		);	}}

/model_demo1/application/Bootstrap.php

<?phpclass Bootstrap extends Zend_Application_Bootstrap_Bootstrap {		protected function _initAutoload() {				$app = $this->getApplication ();		$namespaces = array (				'AppTest' 		);		$app->setAutoloaderNamespaces ( $namespaces );		return $app;	}}

/model_demo1/library/app/Test.php


<?phpclass App_Test {		static public function echoAppTest() {				echo 'App_Test<br/>';	}}

/model_demo1/library/AppTest/Test.php

 

<?phpclass AppTest_Test{	static public function echoAppTestTest(){		echo 'AppTestTest<br/>';	}}

/model_demo1/library/AppTest2/Test.php


 

<?phpclass AppTest2_Test{	static public function echoAppTest2Test(){		echo 'AppTest2Test<br/>';	}}


/model_demo1/library/myApp/Test.php


<?phpclass MyApp_Test {		static public function echoAMyAppTest() {				echo 'MyApp_Test<br/>';	}}


/model_demo1/library/Zend/Test.php


<?phpclass Zend_Test{	static public function echoZendTest(){		echo 'ZendTest<br/>';	}}



沒有貼出的代碼,是創建項目默認的代碼。


 記住:遵循約定規則,就會避免不必要的麻煩。



生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 精品国产一区二区在线 | 国产99在线 | 欧美 | 91视频免费看 | 九九国产| 91香蕉视频污污 | 成人黄色大片免费看 | 亚洲日韩中文字幕一区 | 久久精品日产第一区二区三区 | 丁香六月色婷婷 | 综合精品久久 | 亚洲成人综合在线 | 成人av在线网站 | 亚洲综合无码一区二区 | 自拍偷拍亚洲精品 | 久久国产精品久久 | 国产亚洲高清视频 | 欧美中文字幕一区二区三区亚洲 | 国产一区二区av在线 | 久久不卡 | 一区二区三区中文字幕 | 高潮白浆女日韩av免费看 | 99久久99视频| 精品一区二区三区四区五区六区七区 | 一区二区三区精品在线 | 日韩毛片免费看 | 最好的2019中文字幕视频 | 午夜精品久久久久久久白皮肤 | 久久aⅴ乱码一区二区三区 精品99久久久久久 99热视 | 中文字幕国产在线 | 爱情岛论坛首页永久网址 | 天天综合一区 | 日韩免费视频在线观看 | 国产高清自拍 | 91精品国产综合久久久久久 | 日韩精品大片 | 国产精品无码久久久久 | 中国一级特黄毛片大片 | 黄色福利 | 免费日韩电影 | 福利一区二区 | 日韩久久综合 |