Table of Contents
回复讨论(解决方案)
Home Backend Development PHP Tutorial 在YII中实现三个公共方法

在YII中实现三个公共方法

Jun 23, 2016 pm 02:17 PM

Yii framework

在YII中要实现三个公共方法,大家能否给一下思路,因我才2个多月的基础,刚做开发就是YII,完全没思路啊
1.对博客,论坛,视频等板块的各种资源,比如帖子,文章,视频等,给出一个赞。
2.要求可以对以上资源进行分享。
3.自己发资源的时候可以给资源设定标签。
这些方法可以写在components中,若是基础改继承哪些类啊

回复讨论(解决方案)

初学Yii,你可以先看下基础的教程,尝试使用AR模型,这样子的话,你可以先建一个posts表,存储发布信息的公共部分,这样所有资源可以在一个基础模型里,利用gii可以生成模型和CURD所有代码,然后再根据posts里设置一个资源类型,利用id关联到不同的资源表,至于标签,可另设一个表,关联过去即可。

赞的方法已经搞好了,AR模型已经弄好了,就差打标签了

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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

11 Best PHP URL Shortener Scripts (Free and Premium) 11 Best PHP URL Shortener Scripts (Free and Premium) Mar 03, 2025 am 10:49 AM

11 Best PHP URL Shortener Scripts (Free and Premium)

Working with Flash Session Data in Laravel Working with Flash Session Data in Laravel Mar 12, 2025 pm 05:08 PM

Working with Flash Session Data in Laravel

Simplified HTTP Response Mocking in Laravel Tests Simplified HTTP Response Mocking in Laravel Tests Mar 12, 2025 pm 05:09 PM

Simplified HTTP Response Mocking in Laravel Tests

Build a React App With a Laravel Back End: Part 2, React Build a React App With a Laravel Back End: Part 2, React Mar 04, 2025 am 09:33 AM

Build a React App With a Laravel Back End: Part 2, React

cURL in PHP: How to Use the PHP cURL Extension in REST APIs cURL in PHP: How to Use the PHP cURL Extension in REST APIs Mar 14, 2025 am 11:42 AM

cURL in PHP: How to Use the PHP cURL Extension in REST APIs

12 Best PHP Chat Scripts on CodeCanyon 12 Best PHP Chat Scripts on CodeCanyon Mar 13, 2025 pm 12:08 PM

12 Best PHP Chat Scripts on CodeCanyon

Notifications in Laravel Notifications in Laravel Mar 04, 2025 am 09:22 AM

Notifications in Laravel

Introduction to the Instagram API Introduction to the Instagram API Mar 02, 2025 am 09:32 AM

Introduction to the Instagram API

See all articles