Home > php教程 > php手册 > body text

Yii扩展组件编写方法实例分析,yii扩展组件

WBOY
Release: 2016-06-13 08:59:33
Original
813 people have browsed it

Yii扩展组件编写方法实例分析,yii扩展组件

本文实例讲述了Yii扩展组件编写方法。分享给大家供大家参考。具体如下:

因为Yii本身就引入了Prado的component-based 思想做为主要思想。因此,组件在yii中是很重要的。

组件一般放在components目录里,其格式示例基本如下:

<&#63;php
/**
 * some description about the <span style="color: rgb(34, 34, 34); font-family: Arial, sans-serif; font-size: 12.800000190734863px; line-height: 19px; ">components</span>
 */
class Utilities extends CController
{
  public static function testTool($param)
  {
   // codes
  }
}

Copy after login

使用方法格式示例:

<&#63;php
echo Utilities::testTool($param);
&#63;>

Copy after login

实现的理由也很简单,由于所有的扩展继承了系统的基类,因此,在应用中使用该方法时,yii会导入注册该类方法。

希望本文所述对大家基于Yii框架的php程序设计有所帮助。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!