$this->$function()在PHP中是什么意思?该怎么解决
$this->$function()在PHP中是什么意思?
各位兄弟,最近小弟在看天天团购的代码,结果在/modules/index.mod.php中看到这么一段代码:
- PHP code
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> function ModuleObject( $config ) { $this->MasterObject($config); $runCode = Load::moduleCode($this); $this->$runCode(); }
第五行代码中的$this->$runCode();这句在PHP中有什么特殊含义吗?由于本人PHP没有经过正规的培训,所以一些不太常用的基础规则不明白,希望各位前辈能指导一下,感激不尽。
------解决方案--------------------
手册云:
变量函数
PHP 支持变量函数的概念。这意味着如果一个变量名后有圆括号,PHP 将寻找与变量的值同名的函数,并且将尝试执行它。
------解决方案--------------------
$this->$runCode();
这必然是在你这个类中的了
------解决方案--------------------
class ModuleObject extends MasterObject
去他的父类 还有 公共类去查找
去配置文件 config.php(一般都叫这个)去看看引入的类文件
------解决方案--------------------
$runCode = Load::moduleCode($this);
$this->$runCode();
第二行的$runCode和第一行的$runCode有关系不?

Hot AI Tools

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

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

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

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

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

To work on file upload we are going to use the form helper. Here, is an example for file upload.

In this chapter, we are going to learn the following topics related to routing ?

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

Validator can be created by adding the following two lines in the controller.
