Get the App
SLTechnology News&Howtos  ›  Development  › 

How Zend Framework connects to Mysql database

Shulou Source: shulou.com Published: 2022-06-03 19:52:24 11月12日 Update

This article mainly introduces Zend Framework how to connect to the Mysql database, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

The details are as follows:

Make sure you load the PDO extension correctly before looking at this. The practice is to edit the php.ini.

Manually add these two lines (without a semicolon;):

Extension=php_pdo.dllextension=php_pdo_mysql.dll

And then we're going to put extension_dir

Point to the directory where php_pdo.dll and php_pdo_mysql.dll are located, such as

Extension_dir = "C:/php5/ext"

OK,let's go..

The home page of the index.php website is also the only entrance.

Lib/App/Article.php

ArticleController.php

Class articleController extends Zend_Controller_Action {private $view; private $article; function _ c****truct () {$this- > view = Zend::registry ('view'); $this- > article = new App_Article ();} public function listAllAction () {$this- > article- > listAll (); $this- > view- > title='View Articles'; echo $this- > view- > render (TPL_DIR.'/tplView.php') } function _ call ($action, $arguments) {$this- > _ redirect ('. /'); print_r ($action); print_r ($arguments);}}? >

Visit http://happycms/article/listall

Get the following output:

Array (1) {[0] = > array (15) {["articleid"] = > string (1) "1" ["categoryid"] = > string (1) "0" ["articletitle"] = > string (4) "test" ["articlefromwhere"] = > string (3) "sdf" ["articlekeywords"] = > string (5) "sdfds" ["articledescription"] = > string (4) "test" ["articlebody"] = > string (9) " Sffsdfsdf "[" authorname "] = > string (8)" haohappy "[" authoremail "] = > string (11)" s...@df.com "[" issticky "] = > string (1)" 0 "[" isrecommanded "] = > string (1)" 0 "[" includeattachment "] = > string (1)" 0 "[" addtime "] = > string (19)" 0000-00-0000 "[" lastedittime "] = > string (19) "0000-00-0000: 00:00" ["checktime"] = > string (19) "0000-00-0000: 00:00"} Thank you for reading this article carefully I hope the article "how to connect Zend Framework to Mysql database" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Articles data databases values practices entries interests semicolons at the same time location manual pointing more friends directories knowledge ribbons websites home pages industries Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi MySQL NVidia MariaDB OPPO Reno