對(duì)thinkphp3.1的Action參數(shù)綁定的理解
Jun 07, 2016 pm 05:23 PM? ? thinkphp3.1可以給Action綁定參數(shù)了,就像原生態(tài)的PHP函數(shù)一樣可以傳遞參數(shù),之前我也沒有看過thinkphp3.1官方開發(fā)文檔相關(guān)內(nèi)容,所以在控制器里面寫方法就像寫PHP函數(shù)一樣給它帶上參數(shù),呵呵,沒想到竟然也可以實(shí)現(xiàn)這個(gè)功能。我想,在thinkphp3.0之前應(yīng)該實(shí)現(xiàn)不了。
? ? thinkphp3.1的Action參數(shù)綁定,給控制器的方法帶來了很大靈活性,實(shí)現(xiàn)了控制器之間代碼的共享。其實(shí)當(dāng)初我在用thinkphp3.0就以具備這個(gè)功能了,像數(shù)據(jù)的存取刪除等功能,可以寫在一個(gè)公共的控制器里頭,控制器的方法綁定一個(gè)模型參數(shù),以供其它控制器調(diào)用。
如下面是一個(gè)放在CommonAction公共控制器里的一個(gè)添加數(shù)據(jù)的方法
public?function?addata($module)?{? ????????//$Model?=?$module;? ????????$D?=?D($module);? ????????if?($vo?=?$D->create())?{? ????????????$list?=?$D->add();? ????????????if?($list)?{? ????????????????//數(shù)據(jù)保存觸發(fā)器? ????????????????if(in

Hot AI Tools

Undress AI Tool
Undress images for free

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

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

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Screen brightness is an integral part of using modern computing devices, especially when you look at the screen for long periods of time. It helps you reduce eye strain, improve legibility, and view content easily and efficiently. However, depending on your settings, it can sometimes be difficult to manage brightness, especially on Windows 11 with the new UI changes. If you're having trouble adjusting brightness, here are all the ways to manage brightness on Windows 11. How to Change Brightness on Windows 11 [10 Ways Explained] Single monitor users can use the following methods to adjust brightness on Windows 11. This includes desktop systems using a single monitor as well as laptops. let's start. Method 1: Use the Action Center The Action Center is accessible

To run the ThinkPHP project, you need to: install Composer; use Composer to create the project; enter the project directory and execute php bin/console serve; visit http://localhost:8000 to view the welcome page.

ThinkPHP has multiple versions designed for different PHP versions. Major versions include 3.2, 5.0, 5.1, and 6.0, while minor versions are used to fix bugs and provide new features. The latest stable version is ThinkPHP 6.0.16. When choosing a version, consider the PHP version, feature requirements, and community support. It is recommended to use the latest stable version for best performance and support.

In iOS 17, Apple introduced several new privacy and security features to its mobile operating system, one of which is the ability to require two-step authentication for private browsing tabs in Safari. Here's how it works and how to turn it off. On an iPhone or iPad running iOS 17 or iPadOS 17, Apple's browser now requires Face ID/Touch ID authentication or a passcode if you have any Private Browsing tab open in Safari and then exit the session or app to access them again. In other words, if someone gets their hands on your iPhone or iPad while it's unlocked, they still won't be able to view your privacy without knowing your passcode

Steps to run ThinkPHP Framework locally: Download and unzip ThinkPHP Framework to a local directory. Create a virtual host (optional) pointing to the ThinkPHP root directory. Configure database connection parameters. Start the web server. Initialize the ThinkPHP application. Access the ThinkPHP application URL and run it.

The famous activation script MAS2.2 version supports digital activation again. The method originated from @asdcorp and the team. The MAS author calls it HWID2. Download gatherosstate.exe (not original, modified) from https://github.com/massgravel/Microsoft-Activation-Scripts, run it with parameters, and generate GenuineTicket.xml. First take a look at the original method: gatherosstate.exePfn=xxxxxxx;DownlevelGenuineState=1 and then compare with the latest method: gatheros

Performance comparison of Laravel and ThinkPHP frameworks: ThinkPHP generally performs better than Laravel, focusing on optimization and caching. Laravel performs well, but for complex applications, ThinkPHP may be a better fit.

ThinkPHP installation steps: Prepare PHP, Composer, and MySQL environments. Create projects using Composer. Install the ThinkPHP framework and dependencies. Configure database connection. Generate application code. Launch the application and visit http://localhost:8000.
