php namespace type of knowledge ---

? < PHP 
# namespace namespace used to resolve naming conflicts class, and references to issues 
namespace trainingplan1;
 class mycoach 
{ 
    public function Trainning () 
    { 
        echo " strength exercises, leg, boxing, resisting ability " . " \ The n- " ; 
    } 
} 

namespace trainningplan2;
 class mycoach 
{ 
    public function Trainning () 
    { 
        echo " abdominal muscle, psoas strength, anaerobic exercise, aerobics, wrestling, ground fighting technology " . " \ n- " ; 
    } 
} 

$ CPC =new mycoach();
$cpc->trainning();

?>

Output:

Abdominal, lumbar strength, anaerobic exercise, aerobic exercise, wrestling, ground fighting techniques

# If I just want to kind of trainingplan1 under reference

<? PHP # namespace namespace used to resolve naming conflicts class, and references to issues namespace trainingplan1; class mycoach { public function Trainning () { echo " strength exercises, leg, boxing, resisting ability " . " \ n- " ; } } namespace trainningplan2; class mycoach { public function Trainning () { echo " abdominal muscle, psoas strength, anaerobic exercise, aerobics, wrestling, ground fighting technology " . " \ n- " ; } } $ CPC= new \trainingplan1\mycoach(); $cpc->trainning(); ?>

Output:

Strength training, leg, boxing, resisting ability

Guess you like

Origin www.cnblogs.com/saintdingspage/p/10964308.html