Example analysis of writing methods for Yii extension components, yii extension components_PHP tutorial

WBOY
Release: 2016-07-13 09:48:21
Original
979 people have browsed it

Example analysis of Yii extension component writing method, yii extension component

This article describes the Yii extension component writing method with examples. Share it with everyone for your reference. The details are as follows:

Because Yii itself has introduced Prado’s component-based idea as the main idea. Therefore, components are very important in Yii.

Components are generally placed in the components directory, and their format examples are basically as follows:

<&#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

Usage method format example:

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

Copy after login

The reason for the implementation is also very simple. Since all extensions inherit the base class of the system, when this method is used in the application, Yii will import and register the method of this class.

I hope this article will be helpful to everyone’s PHP programming based on the Yii framework.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1024129.htmlTechArticleExample analysis of Yii extension component writing method, yii extension component This article describes the Yii extension component writing method with examples. Share it with everyone for your reference. The details are as follows: Because Yii itself introduces...
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template