[李景山php]每天TP5-20170125|thinkphp5-Process.php-7

    /**
     * 获取输入
     * @return null|string
     */
    public function getInput()
    {
        return $this->input;
    }// 获取输入信息

    /**
     * 设置输入
     * @param mixed $input
     * @return self
     */
    public function setInput($input)
    {
        if ($this->isRunning()) {
            throw new \LogicException(‘Input can not be set while the process is running.‘);
        }

        $this->input = Utils::validateInput(sprintf(‘%s::%s‘, __CLASS__, __FUNCTION__), $input);

        return $this;
    }// 属于信息 设置

    /**
     * 获取proc_open的选项
     * @return array
     */
    public function getOptions()
    {
        return $this->options;
    }// 获取 选项

    /**
     * 设置proc_open的选项
     * @param array $options
     * @return self
     */
    public function setOptions(array $options)
    {
        $this->options = $options;

        return $this;
    }// 设置选项,这个设置,有点唐突哦

    /**
     * 是否兼容windows
     * @return bool
     */
    public function getEnhanceWindowsCompatibility()
    {
        return $this->enhanceWindowsCompatibility;
    }// 我就是说这个是 windows 兼容的 情况,一般不兼容这个鬼东西

    /**
     * 设置是否兼容windows
     * @param bool $enhance
     * @return self
     */
    public function setEnhanceWindowsCompatibility($enhance)
    {
        $this->enhanceWindowsCompatibility = (bool)$enhance;

        return $this;
    }// 设置 是否兼容 windows

    /**
     * 返回是否 sigchild 兼容模式激活
     * @return bool
     */
    public function getEnhanceSigchildCompatibility()
    {
        return $this->enhanceSigchildCompatibility;
    }// 是否子进程模式 激活

    /**
     * 激活 sigchild 兼容性模式。
     * @param bool $enhance
     * @return self
     */
    public function setEnhanceSigchildCompatibility($enhance)
    {
        $this->enhanceSigchildCompatibility = (bool)$enhance;

        return $this;
    }// 激活它

    /**
     * 是否超时
     */
    public function checkTimeout()
    {// 是否超时
        if ($this->status !== self::STATUS_STARTED) {
            return;
        }// 类型

        if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
            $this->stop();
// 如果 时间 溢出
            throw new ProcessTimeoutException($this, ProcessTimeoutException::TYPE_GENERAL);
        }// 抛出异常

        if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
            $this->stop();

            throw new ProcessTimeoutException($this, ProcessTimeoutException::TYPE_IDLE);
        }// 抛出异常2
    }

    /**
     * 是否支持pty
     * @return bool
     */
    public static function isPtySupported()
    {// 是否支持 pty
        static $result;// 静态结果

        if (null !== $result) {// 有结果,就直接返回
            return $result;
        }

        if (‘\\‘ === DS) {// 在 windows 下呢
            return $result = false;// 返回 错误信息
        }

        $proc = @proc_open(‘echo 1‘, [[‘pty‘], [‘pty‘], [‘pty‘]], $pipes);// 打开类似于管道方式
        if (is_resource($proc)) {// 如果是资源
            proc_close($proc);// 关闭资源

            return $result = true;
        }

        return $result = false;
    }
时间: 2024-07-31 05:34:18

[李景山php]每天TP5-20170125|thinkphp5-Process.php-7的相关文章

[李景山php]每天TP5-20170124|thinkphp5-Process.php-6

/**  * 返回导致子进程终止其执行的数.  * @return int  */ public function getTermSignal() {// 返回 子进程 终止其执行的数     $this->requireProcessIsTerminated(__FUNCTION__);// 确认 进程 函数 已经终止,否则 抛出异常     if ($this->isSigchildEnabled()) {// 确认是否 子进程         throw new \RuntimeExce

[李景山php]每天TP5-20170123|thinkphp5-Process.php-5

    /**      * 开启从底层过程获取输出和错误输出.      * @return Process      * @throws \RuntimeException      */     public function enableOutput()     {// enableOutput         if ($this->isRunning()) {// 如果 运行             throw new \RuntimeException('Enabling outpu

[李景山php]每天TP5-20170122|thinkphp5-Process.php-4

/**  * 获取PID  * @return int|null  * @throws \RuntimeException  */ public function getPid() {// 获取进程 ID     if ($this->isSigchildEnabled()) {         throw new \RuntimeException('This PHP has been compiled with --enable-sigchild. The process identifie

[李景山php]每天TP5-20161221|thinkphp5-jump.php

<?php /**  * 用法:  * load_trait('controller/Jump');  * class index  * {  *     use \traits\controller\Jump;  *     public function index(){  *         $this->error();  *         $this->redirect();  *     }  * }  */ namespace traits\controller; use

[李景山php]每天TP5-20170120|thinkphp5-Process.php-2

/**  * @var array  */ public static $exitCodes = [// 异常退出 代码     0   => 'OK',// 正常退出     1   => 'General error',// 一般性错误     2   => 'Misuse of shell builtins', // 缺少脚本     126 => 'Invoked command cannot execute',// 执行命令错误     127 => 'Comman

[李景山php]每天TP5-20170119|thinkphp5-Process.php-1

<?php // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- // | Copyright (c) 2006~2015 http://thinkphp.cn All 

[李景山php]每天laravel-20160912|FileSystem-3

    /**      * Copy a file to a new location.      *      * @param  string  $path      * @param  string  $target      * @return bool      */     public function copy($path, $target)     {         return copy($path, $target);     }// wrap a copy funct

[李景山php]每天laravel-20161131|BelongsToMany.php-3

    /**      * Save a new model and attach it to the parent model.      *      * @param  \Illuminate\Database\Eloquent\Model  $model      * @param  array  $joining      * @param  bool   $touch      * @return \Illuminate\Database\Eloquent\Model      *

安装TP5(thinkphp5)Composer

1.下载 composer.phar (http:\\www.cnblogs.com/JANCHAN/7735882.html),把composer.phar放入php中(例如php-5.4.45) 再建一个composer.bat放在php中(放在同级的文件夹中)---在里面写    @php "%~dp0composer.phar" %* 2.去网站根目录中的  配置  php.ini 改openssl.dll和fileinfo.dll去掉分号(按ctrl+F搜索) 3.写环境变量