Yii custom verification rules simple method: define rules within the model
The simplest way to define a verification rule is to define it within the model that uses it.
For example, you need to check whether your password is safe enough.
In general,
The first thing to do is to initialize a Model with a scenario. we have two methods to implement it.
The first thing to do is to initialize a Model with a scenario. we have two methods to implement it.1. the new CActiveRecord uses the constructor's
How does Yii ensure the uniqueness of a URL?
For example, we have the following rules:
1
'Post/
'=> 'Post/read ',
The following URLs are valid:
123
Post/read/id/5 post/read? Id = 5 post/5
If we
We need to use the htmlpurifier class in an action, which can enhance any model and indicate the attributes we want to make them XSS secure.
We need to use the htmlpurifier class in an action, which can enhance any model and indicate the attributes
Yii multi-file Upload processing in the controller do you need to call the myFileHandler method that only has file upload fields?
12345678910
PublicfunctionactionIndex (){................ $ model = $ this-> myFileHandler ($ model, array (
There are many ways to automatically set the yii timestamp in the ActiveRecord model. The following two methods are described:
There are many ways to automatically set the yii timestamp in the ActiveRecord model. The following two methods are
Okay, data processing is complete. now we only need to call the relevant data in views/main. php. The keyword is used as an example.
1. create a table structure ?
123456
Create table if not exists 'config' ('name' varchar (128) not null,
Yii searches and sorts data using correlated models in the GridView. First, we have two models that are directly associated with each other.
?
123456789101112131415
ClassAuthorextendsCActiveRecord {...} classPostextendsCActiveRecord {...
I have read several times about using external libraries to Debug PHP code (for example, firePHP). after reading this article, you will find that these external libraries are not necessary in Yii.
I have read several times about using external
This article describes the implementation of the yii verification code, which is just a small example of the application by the Author. it is also available on the internet. to sum up, I hope to help Yii enthusiasts who need it. 1. I use user logon,
As the developer of MutableLabs, I got a task: find a method for recursive deletion in yii. When I ask other developers to look around the Internet, the answer is usually plug-ins or cascading deletion at the database level, but I don't want to do
How to load the Yii-bootstrap extension in a specified action
I encountered a major problem when using Yii-Bootstrap extension, because the pre-loading mechanism made all AJAX requests initialize bootstrap. This is a great waste of resources,
Gii is implemented in a modular manner and must be used in an existing Yii application. To use Gii, first change the application configuration as follows 1. use Gii
Gii is implemented in a modular manner and must be used in an existing Yii
We are very pleased to announce the release of Yii Framework 1.1.11. In this version, we have included more than 100 improvements and bug fixes.
We are very pleased to announce the release of Yii Framework 1.1.11. In this version, we have included
Sometimes we need to render a view in Fancybox.
Sometimes we need to render a view in Fancybox.
This technical guide describes how to implement it.Step 1: Prepare the View File
widget('application.modules.admin.extensions.fancybox.EFancyBox',
This is a simple database-based menu system that uses CMenu rendering.
This is a simple database-based menu system that uses CMenu rendering.Database structure
CREATE TABLE IF NOT EXISTS `menu` ( `menu_id` int(11) NOT NULL auto_increment, `name`
When I add or modify user records, I encountered some trouble in handling and confirming the password. I would like to share with you how I handled it.
When I add or modify user records, I encountered some trouble in handling and confirming the
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.