PHP code example of busyphp / annotation
1. Go to this page and download the library: Download busyphp/annotation 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/ */
busyphp / annotation example snippets
namespace app\home\controller;
class HomeController {
/**
* 通过为属性指定var类型,实现依赖注入
*
* @var \BusyPHP\App
* @BusyPHP\annotation\Inject
*/
protected $test;
/**
* Inject(类路径),实现依赖注入
*
* @BusyPHP\annotation\Inject(\BusyPHP\App::class)
*/
protected $test1;
public function index() {
var_dump($this->test instanceof \BusyPHP\App); // true
var_dump($this->test1 instanceof \BusyPHP\App); // true
}
}