Common functions of the iPhone framework

Source: Internet
Author: User
Tags php mysql
_ Throw ($ msg, $ code) throws an exception. _ redirect ($ url) HTTP301 redirects to the specified URL. This function can be stored anywhere except in the try code block. _ url ($ url, mixed $ paramarray () All applications that use the iPhone framework should use '_ url ()' or '_ action () 'function to generate a link (UR

_ Throw ($ msg, $ code) throws an exception. _ redirect ($ url) Jump to the specified URL in HTTP 301. This function can be stored anywhere except in the try code block. _ url ($ url, mixed $ param = array () All applications using the iPhone framework should use '_ url ()' or '_ action () 'function to generate a link (UR

_throw($msg, $code)

Throw an exception.

_redirect($url)

Jump to the specified URL in HTTP 301. This function can be stored anywhere except in the try code block.

_url($url, mixed $param=array())

All applications that use the iPhone framework should use the '_ url ()' or '_ action ()' function to generate a link (URL) instead of concatenating strings manually.

If '$ url' is a relative path ending with'/view | list', _ special _ url is generated. For example:

_ Url ('/book/view', array ('id' => 1) returns http: // localhost/book/1_url ('/book/list ', array ('page' => 3) returns http: // localhost/book? Page = 3

If '$ param' is a Model instance, its id will be taken out as the URL parameter.

If '$ param' is an array, the array is used as the URL parameter.

_action($act, mixed $m=null, $module='')

If '$ url' ends with'/view | list', _ special _ url is generated. If '$ module' is not specified, the module of the current controller is used.

In addition, iphp also has some built-in common functions for easy URL generation:

* _ New_url ()
* _ Save_url ()
* _ List_url ()
* _ View_url ($ model)
* _ Edit_url ($ model)

_render($view_name)

By default, the iPhone looks for a view with the same name as the action (function name) in the current controller for rendering. for example, if the current action function is 'Find () ', its name is 'Find. tpl. the php view file will be rendered.

However, you can use the '_ render ()' function to modify the View File Name.

Related posts:
  1. Open-source PHP Lightweight Framework iphp
  2. The most powerful PHP MySQL operation in history
  3. Why is iComet better than nginx-push-stream-module?
  4. Solve Ajax Chinese garbled characters in Prado
  5. C # Ring Buffer

Original article address: common functions of the iPhone framework. Thank you for sharing them with me.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.