PHP code example of lisao / ioc
1. Go to this page and download the library: Download lisao/ioc library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lisao / ioc example snippets
namespace test;
public $b;
public function __construct(\test\b $obj) {
$this->b = $obj;
}
public function name() {
echo 'a';
}
}
class b {
public function name() {
echo 'b';
}
}
$app = new \Lisao\Ioc\Ioc::getInstance('\test\a');
$app->b->name();
//输出
b