zoukankan      html  css  js  c++  java
  • php-构造函数-返回值

    class NewClass {
    
        public function __construct () {
            return 'Hello World!!';
        }
         
    }
     
    $info = new NewClass;
    echo $info -> __construct();
        function __construct($conf=array())
        {
            if($conf){
                return $this->connect($conf['host'], $conf['username'], $conf['secret']);
            }else{
                $config = @parse_ini_file('/etc/asterisk/manager.conf', true);
                $telnat = array();
                foreach ($config as $key => $value){
                    if($key !=="general"){
                        $telnat['user'] = $key;
                        $telnat['secret'] = $value['secret'];
                    }else{
                        $telnat['port'] = $value['port'];
                    }
                }
    //            return $this->connect('localhost:' . $config['general']['port'], 'admin', $config['admin']['secret']);
                $info  =  $this->connect('localhost:' . $telnat['port'], $telnat['user'], $telnat['secret']);
                if($info !== false){
                     return    $this->connect('localhost:' . $telnat['port'], $telnat['user'], $telnat['secret']);
                }
                if($info === false){
                  return 'false';
                }
            }
        }
    
    
        if ($this->socket == false) {
    //            $this->log("Unable to connect to manager {$this->server}:{$this->port} ($errno): $errstr");
    //            socket 连接失败,程序自动终止
    //            exit("Unable to connect to manager {$this->server}:{$this->port} ($errno): " . iconv("gb2312", "UTF-8", $errstr));
    //            die(false);
                return false;
            }
  • 相关阅读:
    windows 设置nginx开机自启动
    vue js中解决二进制转图片显示问题
    oracle 各种问题
    Nginx安装及配置详解包括windows linux 环境
    AOP-切面是如何织入到目标对象中的
    AOP-通知-笔记
    AOP-方法拦截器-笔记
    JdkDynamicAopProxy-笔记
    Joinpoint继承体系-笔记
    AOP-Pointcut-笔记
  • 原文地址:https://www.cnblogs.com/CWQPHP/p/10690476.html
Copyright © 2011-2022 走看看