From the beginning of the second week of PHP, it was open to contact the Zend Framework, but then it was released. At that time did not take notes, and then forget everything, back to regret Ah, now learn it again!
Today to see is the controller, this thing is too big, I also just look at the fur, from the far to the!
The following is a simple controller:
Class Hellocontroller extends Zend_controller_action
{
function Indexaction ()
{
echo "Hi, this are my HelloWorld";
}
function Testaction ()
{
$var 1 = $this->_getparam ("var");
echo "Hello" $book _id;
}
function __call ($action, $args) {
$this->_redirect ('/hello ');
}
}
The result of the run is this:
Http://localhost/hello/test/var/world will show Hellowrold
When Http://localhost/hello/netaction, the hi is displayed, this is my HelloWorld
In fact, I would like to explain the above two points of color separations:
Red: In Zend, I have receive parameters, whether post or get, as long as:
$this->_getparam ("var");
The form can be,
The final protected function _getparam ($paramName, $default = null) is the private method of the controller, but it takes the second argument as the default and returns the default value when the parameter you want is not obtained.
Blue: The purpose of this function is to go to an address when the access method does not exist (here is: Http://localhost/hello)
</