PHP code example of jian1098 / tp-constant

1. Go to this page and download the library: Download jian1098/tp-constant 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/ */

    

jian1098 / tp-constant example snippets


  return [
      'Jian1098\TpConstant\Command\Make\Constant'
  ];
  

  
  
  namespace app\api\controller;
  
  use app\common\constant\TestConstant;
  use think\Controller;
  
  class Test extends Controller
  {
      //index
      public function index()
      {
          var_dump(TestConstant::SERVER_ERROR); //使用常量
      }
  }
  
bash
  php think make:constant TestConstant