_throw($msg, $code) 抛出异常. _redirect($url) HTTP 301 跳转到指定的 URL, 该函数除了不能放在 try 代码块中外, 可以放在任何地方. _url($url, mixed $param=array()) 所有使用 iphp 框架的应用, 都应该使用 `_url()` 或者 `_action()` 函数来生成链接(UR
_throw($msg, $code)
抛出异常.
_redirect($url)
HTTP 301 跳转到指定的 URL, 该函数除了不能放在 try 代码块中外, 可以放在任何地方.
_url($url, mixed $param=array())
所有使用 iphp 框架的应用, 都应该使用 `_url()` 或者 `_action()` 函数来生成链接(URL), 而不是手动拼接字符串.
若 `$url` 是相对路径且以 `/view|list` 结尾, 则会生成__特殊__ URL. 例如:
_url('/book/view', array('id'=>1)) 返回 http://localhost/book/1 _url('/book/list', array('page'=>3)) 返回 http://localhost/book?page=3
若 `$param` 是 Model 的实例, 则其 id 会被取出来作为 URL 参数.
若 `$param` 是数组, 则该数组作为 URL 的参数.
_action($act, mixed $m=null, $module='')
若 `$url` 以 `/view|list` 结尾, 则会生成__特殊__ URL. 如果不指定 `$module`, 则使用当前 controller 的 module.
另外, iphp 还内置了一些常用函数, 用于简便地生成 URL:
* _new_url()
* _save_url()
* _list_url()
* _view_url($model)
* _edit_url($model)
_render($view_name)
默认 iphp 会寻找与当前 controller 中的 action(函数名)同名的 view 来渲染. 如, 当前的 action 函数是 `find()`, 那么名字为 `find.tpl.php` 的视图文件将会被渲染.
但你可以通过 `_render()` 函数修改视图文件的名字.
Related posts:
- 开源的 PHP 轻量级框架 iphp
- 史上最强大的PHP MySQL操作类
- 为什么iComet比nginx-push-stream-module更好?
- Prado 中解决 Ajax 中文乱码问题
- C#环形缓冲
原文地址:iphp框架常用函数, 感谢原作者分享。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Dreamweaver Mac version
Visual web development tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.