<?php
namespace appindexcontroller;
/*
*URl访问
*/
class Demo1
{
public function getName($name="peter")
{
return $name;
}
//依赖注入
public function getMethod(appcommonTemp $temp)
{
$temp->setName("wom");
return $temp->getName();
}
public function bindClass()
{
hinkContainer::set('temp','appcommonTemp');
$temp= hinkContainer::get('temp',['name'=>'nishiwo']);
return $temp->getName();
}
public function bindClosure()
{
hinkContainer::set('demo',function($domain){
return $domain;
});
return hinkContainer::get('demo',['domain'=>'nishi']);
}
}
php知识网