久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php如何在內(nèi)部引用私有方法

      php在內(nèi)部引用私有方法的方法:在調(diào)用【get()】方法時,在前面加上【$this】,代碼為【$con = $this->get($name, $age);echo "my name is :".$name."
      ";】。

      php如何在內(nèi)部引用私有方法

      php在內(nèi)部引用私有方法的方法:

      這段代碼很簡單,我想實現(xiàn)類的內(nèi)部私有方法的調(diào)用。如第4行所示。以前寫js習(xí)慣了,在調(diào)用get()方法時,沒有在前面加上"$this",程序會出現(xiàn)問題。補上之后就可以調(diào)用了。

      <?php class Person {     public function say($name, $age) {         $con = $this->get($name, $age); //這里的$this->是關(guān)鍵         echo "my name is :".$name."<br />";         echo "my age is :".$age."<br/>";         echo "get :".$con."<br/>";     }     private function get($a, $b) {         $a = $a.$b;         return $a;     } } $person=new Person(); $person->say("ren", 25); ?>

      相關(guān)免費學(xué)習(xí)推薦:php編程(視頻)

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號