本文主要是介绍PHP基础知识构造函数,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
PHP基础知识构造函数
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2016/7/16 0016
* Time: 15:05
*/
header ( "Content-type:text/html;charset=utf-8" );
class Site{
public $url = "this is public" ; //public,private,protected;
private $url2 = "this is private" ;
protected $url3 = "this is protected" ;
private $mySite ;
static public $myName ;
//构造函数。
public function __construct( $site )
{
$this -> mySite = $site ;
echo "我是构造函数<br>"
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2016/7/16 0016
* Time: 15:05
*/
header ( "Content-type:text/html;charset=utf-8" );
class Site{
public $url = "this is public" ; //public,private,protected;
private $url2 = "this is private" ;
protected $url3 = "this is protected" ;
private $mySite ;
static public $myName ;
//构造函数。
public function __construct( $site )
{
$this -> mySite = $site ;
echo "我是构造函数<br>"
这篇关于PHP基础知识构造函数的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!