Blogger Information
Blog 250
fans 3
comment 0
visits 321694
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
OOP 面向对象 const修饰定义常量
梁凯达的博客
Original
999 people have browsed it

实例

<?php

	//const 可以在类里面定义常量
	//类里面定义的常量需要使用范围操作符类进行使用
	//类名:: 常量名  A::DB  A::SJ
	//define  不能在类里面定义常量
	//
	
	// define('HOST','localhost');
	// echo HOST;
	// const PWD =123;
	// echo PWD;

	class A{
		//define('DB','ss34');
		const DB = 'ss34';
		const SJ = '社会我金哥,人狠话不多,信金哥没坎坷,啪啪一路小平坡';
	}

	echo  A::DB;
	echo A::SJ;

运行实例 »

点击 "运行实例" 按钮查看在线实例

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post