walkor / webman-framework

webman-framework
116 stars 57 forks source link

Helper function upgrade #61

Closed 377960738 closed 2 years ago

377960738 commented 2 years ago
  1. 新增助手函数 run_path , 返回当前程序运行目录 (支持phar)
    /**
    * return the program execute directory
    * @param string $path
    * @return string
    */
    function run_path(string $path = '')
    {
    static $run_path = '';
    if (!$run_path) {
        $run_path = \is_phar() ? \dirname(\Phar::running(false)) : BASE_PATH;
    }
    return \path_combine($run_path, $path);
    }
  2. 路径相关函数支持传入后续路径,不影响原有代码,具体如下
    
    # base_path 接参微调
    # 原 base_path(bool $return_phar = true)
    # 现 base_path(string|false $path = '')

app_path(string $path = '')

public_path(string $path = '')

config_path(string $path = '')

runtime_path(string $path = '')

walkor commented 2 years ago

Thanks