PHP code example of yangkai / server-code-version

1. Go to this page and download the library: Download yangkai/server-code-version 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/ */

    

yangkai / server-code-version example snippets



server {

        listen 80;
        server_name  localhost;
        index index.php index.html;
        #设置你的项目名称
        set $project "version";

        #HTTP版本配置
        if ( $http_server_code_version = "" ) { 
                set $http_server_code_version "master";
        }
        
        location /server-version {
                try_files $uri $uri/ /index.php;
        }
        
        #设置项目目录
        set $rootPath "/www/project/${project}/${http_server_code_version}";

        #php配置
        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            #SERVER_CODE_VERSION 是php用来区分你的版本号的必须配置
            fastcgi_param  SERVER_CODE_VERSION $http_server_code_version;