关于include文件赋值的问题

PHPz
Release: 2021-03-23 10:37:15
Original
1428 people have browsed it

本文给大家介绍关于include文件赋值的问题,希望对需要的朋友有所帮助!

PHP实战教程//m.sbmmt.com/k.html

具体问题:

include文件:

Copy after login
data = $_CFG; 
} 
final protected function _clone(){ 
} 
public static function getIns(){ 
if(self::$ins instanceof self){ return self::$ins; }
else{
self::$ins = new self(); return self::$ins; } }}
$conf = conf::getIns();print_r($conf);
Copy after login

测试结果是:

conf Object ( [data:protected] => Array ( ) )
Copy after login

为什么数组$_CFG中的值没有被赋给全局变量protected $data呢?

解决方案:

因为你漏掉了一个下划线

__construct  
__clone
Copy after login
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!