• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getHostByName函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中getHostByName函数的典型用法代码示例。如果您正苦于以下问题:PHP getHostByName函数的具体用法?PHP getHostByName怎么用?PHP getHostByName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getHostByName函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: testItCanGetJobProgressionFromApiInRealLife

 public function testItCanGetJobProgressionFromApiInRealLife()
 {
     // Check for and set required server variables
     if (!isset($_SERVER['PARTNER_ID'])) {
         $this->markTestSkipped('PARTNER_ID is not available');
     }
     if (!isset($_SERVER['PARTNER_KEY'])) {
         $this->markTestSkipped('PARTNER_KEY is not available');
     }
     $_SERVER['REMOTE_ADDR'] = getHostByName(getHostName());
     $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36';
     // Instantiate the connection
     $config = new Config($_SERVER['PARTNER_ID'], $_SERVER['PARTNER_KEY']);
     $connection = new Connection($config);
     $action = new JobProgression();
     $action->addparam('jobTitle', 'developer');
     // Get the response from the API
     $response = $connection->call($action);
     // Assert proper classes/results are returned
     $this->assertEquals('Glassdoor\\ResponseObject\\JobProgressionResponse', get_class($response));
     foreach ($response->getJobProgressions() as $progression) {
         $this->assertEquals('Glassdoor\\ResponseObject\\JobProgression', get_class($progression));
         $this->assertNotNull($progression->getJobTitle());
     }
 }
开发者ID:karllhughes,项目名称:glassdoor,代码行数:25,代码来源:JobProgressionAcceptanceTest.php


示例2: __construct

 public function __construct()
 {
     //
     $this->id = 'komercigateway';
     $this->icon = plugins_url('images/komerci.png', __FILE__);
     $this->has_fields = true;
     $this->method_title = 'Komerci Settings';
     //
     $this->init_form_fields();
     $this->init_settings();
     //
     $this->title = $this->get_option('title');
     $this->description = $this->get_option('description');
     $this->filiacao = $this->get_option('filiacao');
     $this->token = $this->get_option('token');
     $this->method = $this->get_option('method');
     //
     $this->user = $this->get_option('user');
     $this->password = $this->get_option('password');
     //
     $this->test = $this->get_option('test');
     $this->supports = array('default_credit_card_form');
     $this->komerci_cardtypes = $this->get_option('komerci_cardtypes');
     //
     $this->siteurl = $_SERVER['SERVER_NAME'];
     $this->serverip = getHostByName(php_uname('n'));
     //
     $this->komerci_wsdlurl = 'https://ecommerce.redecard.com.br/pos_virtual/wskomerci/cap.asmx?WSDL';
     $this->komerci_liveurl = 'https://ecommerce.redecard.com.br/pos_virtual/wskomerci/cap.asmx';
     $this->komerci_testurl = 'https://ecommerce.redecard.com.br/pos_virtual/wskomerci/cap_teste.asmx';
     $this->komerci_methodurl = 'https://ecommerce.redecard.com.br/pos_virtual/wskomerci/cap.asmx?op=GetAuthorized';
     if (is_admin()) {
         add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
     }
 }
开发者ID:eltondev,项目名称:komerci,代码行数:35,代码来源:woocommerce-komerci.php


示例3: process_report_command

function process_report_command($command)
{
    $public_ip = getHostByName(php_uname('n'));
    $pid = (string) getmypid();
    print sprintf("REPORT: public_ip: %s, pid: %s\n\r", $public_ip, $pid);
    $command->process(compact('public_ip', 'pid'));
}
开发者ID:attm2x,项目名称:m2x-php-mqtt,代码行数:7,代码来源:process_commands.php


示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('users')->delete();
     $thisIP = getHostByName(getHostName());
     $testuser = User::create(array('username' => 'admin', 'email' => '[email protected]', 'password' => Hash::make('admin'), 'created_ip' => $thisIP, 'last_ip' => $thisIP, 'created_by_user_id' => 1));
     DB::table('user_permissions')->delete();
     UserPermission::create(array('user_id' => $testuser->id, 'solder_full' => true));
 }
开发者ID:GoatEli,项目名称:TechnicSolder,代码行数:13,代码来源:UserTableSeeder.php


示例5: userLastVisit

 protected function userLastVisit($user_id)
 {
     $model = User::findOrFail($user_id);
     date_default_timezone_set("Asia/Dacca");
     $date = date('Y-m-d H:i:s', time());
     $model->last_visit = $date;
     $model->ip_address = getHostByName(getHostName());
     $model->save();
 }
开发者ID:selimppc,项目名称:ecies,代码行数:9,代码来源:AdminController.php


示例6: getLocalIp

 public function getLocalIp()
 {
     $CI = & get_instance();
     $ip = $CI->input->ip_address();
     if ($ip == '::1') {
         $ip = getHostByName(getHostName());
     }
     return $ip;
 }
开发者ID:nhatlang19,项目名称:elearningONL,代码行数:9,代码来源:Utils.php


示例7: ServerDetails

function ServerDetails()
{
    echo "<div id=\"ServerDetails\">a\n\t\t\t<h3>Server Details</h3><br>";
    echo 'Current PHP version: ' . phpversion() . "<br>";
    echo 'Current Operating System:' . php_uname();
    echo '<br>IP Address of Server: ' . getHostByName($_SERVER['HTTP_HOST']) . "<br>";
    echo $_SERVER['SERVER_SOFTWARE'];
    echo "</div>";
}
开发者ID:ScottRMcleod,项目名称:PHP,代码行数:9,代码来源:GetingServerDetails.php


示例8: index

 function index()
 {
     $data['system'] = $_SERVER['HTTP_USER_AGENT'];
     //操作系统与浏览器信息
     $data['server'] = PHP_OS . '&nbsp;&nbsp; PHP v' . PHP_VERSION;
     //php版本等信息
     $data['web'] = $_SERVER['SERVER_SOFTWARE'] . '&nbsp;&nbsp;' . getenv("HTTP_ACCEPT_LANGUAGE");
     //WEB服务器版本
     $data['safe'] = @ini_get('safe_mode') ? 'ON' : 'OFF';
     //安全模式
     $data['mysql'] = mysql_get_server_info();
     //mysql版本
     $data['cfg_var'] = get_cfg_var("memory_limit") ? get_cfg_var("memory_limit") : "无";
     //可用最大内存
     $data['cfg_max_size'] = get_cfg_var("post_max_size");
     //POST提交限制
     $data['max_execution_time'] = get_cfg_var("max_execution_time");
     //脚本超出时间
     $data['max_file_size'] = get_cfg_var("upload_max_filesize") ? get_cfg_var("upload_max_filesize") : "不允许上传附件";
     //上传限制
     $data['allow_url_fopen'] = @ini_get('allow_url_fopen') ? "ON" : "OFF";
     //是否允许打开远程文件
     $data['disk_size'] = $this->noya->get_file_size(disk_free_space("."));
     //服务器剩余空间大小
     //计算数据库大小
     $content_datasize = $datasize = $indexsize = 0;
     $query = $this->db->query("SHOW TABLE STATUS");
     //$this->fire_php->fire_start($this->noya->get_last_query());
     if ($query->num_rows() > 0) {
         foreach ($query->result() as $row) {
             $datasize += $row->Data_length;
             $indexsize += $row->Index_length;
             $content_datasize += $row->Data_length + $row->Index_length;
         }
     }
     $data['content_datasize'] = $this->noya->get_file_size($content_datasize);
     //GD库是否支持
     $data['GD'] = function_exists("imageline") == 1 ? $this->noya->temp(function_exists("imageline")) : $this->noya->temp(function_exists("imageline"));
     //SESSION是否支持
     $data['allow_session'] = $this->noya->temp(function_exists("session_start"));
     //网站域名
     $data['host_name'] = $_SERVER['SERVER_NAME'];
     //网站IP
     $data['host_address'] = getHostByName(php_uname('n')) . ':' . $_SERVER['SERVER_PORT'];
     //网站当前时间
     $data['host_data'] = date("Y-m-d  H:i");
     //当前访问者ip
     $data['memeber_ip'] = $_SERVER["SERVER_ADDR"];
     //被屏蔽函数
     $data['disable_funcs'] = get_cfg_var("disable_functions") ? get_cfg_var("disable_functions") : "无";
     $this->load->vars($data);
     $this->load->view('backend/main');
 }
开发者ID:miguelmeca,项目名称:wscat,代码行数:53,代码来源:main.php


示例9: hocwp_get_pc_ip

function hocwp_get_pc_ip()
{
    $result = '';
    if (function_exists('getHostByName')) {
        if (version_compare(PHP_VERSION, '5.3', '<') && function_exists('php_uname')) {
            $result = getHostByName(php_uname('n'));
        } elseif (function_exists('getHostName')) {
            $result = getHostByName(getHostName());
        }
    }
    return $result;
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:12,代码来源:core-functions.php


示例10: DVRUI_HDHRjson

 public function DVRUI_HDHRjson()
 {
     $storageURL = "??";
     $myip = getHostByName(getHostName());
     $hdhr_data = getJsonFromUrl($this->myhdhrurl);
     for ($i = 0; $i < count($hdhr_data); $i++) {
         $hdhr = $hdhr_data[$i];
         $hdhr_base = $hdhr[$this->hdhrkey_baseURL];
         $hdhr_ip = $hdhr[$this->hdhrkey_localIP];
         if (!array_key_exists($this->hdhrkey_discoverURL, $hdhr)) {
             // Skip this HDHR - it doesn't support the newer HTTP interface
             // for DVR
             continue;
         }
         $hdhr_info = getJsonFromUrl($hdhr[$this->hdhrkey_discoverURL]);
         if (array_key_exists($this->hdhrkey_storageURL, $hdhr)) {
             // this is a record engine!
             // Need to confirm it's a valid one - After restart of
             // engine it updates my.hdhomerun.com but sometimes the
             // old engine config is left behind.
             $rEngine = getJsonFromUrl($hdhr[$this->hdhrkey_discoverURL]);
             if (strcmp($rEngine[$this->hdhrkey_storageID], $hdhr[$this->hdhrkey_storageID]) != 0) {
                 //skip, this is not a valid engine
                 continue;
             }
             //get the IP address of record engine.
             $hdhr_ip = $hdhr[$this->hdhrkey_localIP];
             // Split IP and port
             if (preg_match('/^(\\d[\\d.]+):(\\d+)\\b/', $hdhr_ip, $matches)) {
                 $ip = $matches[1];
                 $port = $matches[2];
                 // if IP of record engine matches the IP of this server
                 // return storageURL
                 if ($ip == $myip) {
                     $this->storageURL = $hdhr[$this->hdhrkey_storageURL];
                     continue;
                 }
             }
         }
         // ELSE we have a tuner
         $tuners = 'unknown';
         if (array_key_exists($this->hdhrkey_tuners, $hdhr_info)) {
             $tuners = $hdhr_info[$this->hdhrkey_tuners];
         }
         $legacy = 'No';
         if (array_key_exists($this->hdhrkey_legacy, $hdhr_info)) {
             $legacy = $hdhr_info[$this->hdhrkey_legacy];
         }
         $hdhr_lineup = getJsonFromUrl($hdhr_info[$this->hdhrkey_lineupURL]);
         $this->hdhrlist[] = array($this->hdhrkey_devID => $hdhr[$this->hdhrkey_devID], $this->hdhrkey_modelNum => $hdhr_info[$this->hdhrkey_modelNum], $this->hdhrlist_key_channelcount => count($hdhr_lineup), $this->hdhrkey_baseURL => $hdhr_base, $this->hdhrkey_lineupURL => $hdhr_info[$this->hdhrkey_lineupURL], $this->hdhrkey_modelName => $hdhr_info[$this->hdhrkey_modelName], $this->hdhrkey_auth => $hdhr_info[$this->hdhrkey_auth], $this->hdhrkey_fwVer => $hdhr_info[$this->hdhrkey_fwVer], $this->hdhrkey_tuners => $tuners, $this->hdhrkey_legacy => $legacy, $this->hdhrkey_fwName => $hdhr_info[$this->hdhrkey_fwName]);
     }
 }
开发者ID:Silicondust,项目名称:dvr_install,代码行数:52,代码来源:dvrui_hdhrjson.php


示例11: testItCanGetJobsFromApi

 /**
  * Integration test with actual API call to the provider.
  */
 public function testItCanGetJobsFromApi()
 {
     if (!getenv('PARTNER_ID')) {
         $this->markTestSkipped('PARTNER_ID not set. Real API call will not be made.');
     }
     $keyword = 'engineering';
     $query = new JujuQuery(['k' => $keyword, 'partnerid' => getenv('PARTNER_ID'), 'ipaddress' => getHostByName(getHostName())]);
     $client = new JujuProvider($query);
     $results = $client->getJobs();
     $this->assertInstanceOf('JobApis\\Jobs\\Client\\Collection', $results);
     foreach ($results as $job) {
         $this->assertEquals($keyword, $job->query);
     }
 }
开发者ID:jobbrander,项目名称:jobs-juju,代码行数:17,代码来源:JujuProviderTest.php


示例12: connect

 public function connect()
 {
     $hostname = "localhost";
     $username = "root";
     $password = "123456";
     $_dbsname = "kepe3788_db";
     if (getHostByName(getHostName()) != '127.0.1.1') {
         $hostname = "103.247.8.138";
         $username = "kepe3788_user";
         $password = "1234_asdf";
         $_dbsname = "kepe3788_db";
     }
     $this->conn = new mysqli($hostname, $username, $password, $_dbsname);
     if ($this->conn->connect_error) {
         die("Connection failed: " . $this->conn->connect_error);
     }
     return $this->conn;
 }
开发者ID:kepoabiscom,项目名称:kepe-dev,代码行数:18,代码来源:db.php


示例13: up

 /**
  * Make changes to the database.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('users', function ($table) {
         $table->increments('id');
         $table->string('username');
         $table->string('email');
         $table->string('password');
         $table->string('created_ip');
         $table->string('last_ip')->nullable();
         $table->timestamps();
     });
     /**
      * Create Default User
      **/
     $user = new User();
     $user->username = 'admin';
     $user->email = '[email protected]';
     $user->password = Hash::make('admin');
     $user->created_ip = getHostByName(getHostName());
     $user->save();
 }
开发者ID:GoatEli,项目名称:TechnicSolder,代码行数:26,代码来源:2013_02_27_184039_create_users_table.php


示例14: getIP

function getIP()
{
    $ip = $_SERVER['SERVER_ADDR'];
    if (PHP_OS == 'WINNT') {
        $ip = getHostByName(getHostName());
    }
    if (PHP_OS == 'Linux') {
        $command = "/sbin/ifconfig";
        exec($command, $output);
        // var_dump($output);
        $pattern = '/inet addr:?([^ ]+)/';
        $ip = array();
        foreach ($output as $key => $subject) {
            $result = preg_match_all($pattern, $subject, $subpattern);
            if ($result == 1) {
                if ($subpattern[1][0] != "127.0.0.1") {
                    $ip = $subpattern[1][0];
                }
            }
        }
    }
    return $ip;
}
开发者ID:Roveref,项目名称:www,代码行数:23,代码来源:qSimpleSending.php


示例15: getIpAddress

 /**
  * Get IP Address
  *
  * @return  string
  */
 public function getIpAddress()
 {
     return getHostByName(getHostName());
 }
开发者ID:startupwrench,项目名称:startupwrench,代码行数:9,代码来源:Simplyhired.php


示例16: detect

 /**
  * Detect Data for anvilSession Use
  */
 public function detect()
 {
     //        global $phpAnvil;
     if ($this->_detectExecuted) {
         //			$this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, 'Already Executed - skipping...');
         //            FB::info('Already Executed - skipping...');
         $this->_logVerbose('Already Executed - skipping...');
     } else {
         //			$this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, "Executing...");
         //            FB::info('Executing...');
         $this->_logVerbose('Executing...');
         $this->thisVisitDTS = date('Y-m-d H:i:s');
         #---- Detect User IP
         if ($this->_isConsole) {
             $this->userIP = getHostByName(SITE_DOMAIN);
         } else {
             $this->userIP = $_SERVER['REMOTE_ADDR'];
         }
         //			$this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, 'User IP = ' . $this->userIP);
         $this->_logVerbose('User IP = ' . $this->userIP);
         //            FB::log($this->userIP, '$this->userIP');
         #---- Detect User Agent
         if (isset($_SERVER['HTTP_USER_AGENT'])) {
             $this->userAgent = $_SERVER['HTTP_USER_AGENT'];
             //				$this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, 'User Agent = ' . $this->userAgent);
             $this->_logVerbose('User Agent = ' . $this->userAgent);
             //                FB::log($this->userAgent, '$this->userAgent');
         }
         //            FB::log($this->sessionName, '$this->sessionName');
         //            FB::log($_REQUEST[$this->sessionName], '$_REQUEST[$this->sessionName]');
         #---- Detect Existing Session
         if (isset($_COOKIE[$this->sessionName])) {
             //                FB::log('Detected existing session...');
             $this->_new = false;
             //				$this->id = $_REQUEST[$this->sessionName];
             $this->phpSessionID = $_COOKIE[$this->sessionName];
             #---- Session Cookie Detection
             //				$this->_cookieDetected = isset($_COOKIE[$this->sessionName]);
             $this->_cookieDetected = true;
             $this->id = $_COOKIE[$this->sessionName];
             //				$this->phpSessionID = $_COOKIE[$this->sessionName];
             //				$msg = 'anvilSession Cookie Detected';
             //                $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, $msg);
             //                FB::info($msg);
             $this->_logVerbose('anvilSession Cookie Detected');
             #---- Test Parameter Detection
             //				if (isset($_GET[$this->testParameterName])) {
             //					$this->_new = true;
             //					$msg = 'Cookie Test Parameter Detected - New Session';
             //                        $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, $msg);
             //                        FB::info($msg);
             //				}
             #---- Reset Detection
             if ($this->_resetEnabled) {
                 $this->_new = true;
                 //					$msg = 'Reset Detected - New Session';
                 //                        $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, $msg);
                 //                        FB::warn($msg);
                 $this->_logVerbose('Reset Detected - New Session');
             }
             #---- Check and Load Session
             /*			} else {
                                     #---- Security and Age Detection
                     //				$this->phpSessionID = $_REQUEST[$this->sessionName];
                                     $sql = 'SELECT * FROM ' . $this->sessionsTable;
             
                     //				if ($this->isCookieDetected()) {
                                         $sql .= ' WHERE session_id = ' . $this->id;
                     //				} else {
                     //					$sql .= ' WHERE ascii_session_id = ' . $this->devData->dbString($this->phpSessionID);
                     //				}
             
                                     $objRS = $this->devData->execute($sql);
                                     if ($objRS->read()) {
                                         $this->id = $objRS->data('session_id');
                                         $this->userID = $objRS->data('user_id');
             
                                         $this->new = false;
             
                                         setcookie($this->cookieName, $this->id, $this->sessionLifespan, $this->cookieDomain);
             
                                         $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, 'Session #' . $this->id . ' Loaded for ' . $this->userIP);
                                     }
                                     $objRS->close();
                                 }
                                 $this->save();
                     */
             #---- Cookie Test Detection
             //			} elseif (isset($_COOKIE[$this->testCookieName])) {
             //				$this->_cookieDetected = true;
             //				$msg = 'Test Cookie Detected';
             //                        $this->_addTraceInfo(__FILE__, __METHOD__, __LINE__, $msg);
             //                        FB::info($msg);
             #---- Cookie Test Detection (passed variable and no cookie)
             //			} elseif (isset($_GET[$this->testParameterName])) {
             //				#---- No Cookie Support
             //				ini_set('session.use_trans_sid', '1');
//.........这里部分代码省略.........
开发者ID:nslevkoff,项目名称:phpAnvil2,代码行数:101,代码来源:anvilSession.class.php


示例17: _getServerInfos

 /**
  * 获取网站服务器相关信息.
  *
  * @return array
  *
  * @author freephp
  */
 private function _getServerInfos()
 {
     return ['os_version' => php_uname(), 'server_php_version' => $_SERVER['SERVER_SOFTWARE'], 'domain' => $_SERVER['HTTP_HOST'], 'server_port' => $_SERVER['SERVER_PORT'], 'database' => 'MySQL', 'server_ip' => getHostByName($_SERVER['SERVER_NAME'])];
 }
开发者ID:freephp2015,项目名称:newcom,代码行数:11,代码来源:index.php


示例18: detectProductionMode

 /**
  * Detects production mode by IP address.
  * @return bool
  */
 public static function detectProductionMode()
 {
     $addrs = array();
     if (PHP_SAPI === 'cli') {
         $addrs[] = getHostByName(php_uname('n'));
     } else {
         if (!isset($_SERVER['SERVER_ADDR']) && !isset($_SERVER['LOCAL_ADDR'])) {
             return TRUE;
         }
         if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
             // proxy server detected
             $addrs = preg_split('#,\\s*#', $_SERVER['HTTP_X_FORWARDED_FOR']);
         }
         if (isset($_SERVER['REMOTE_ADDR'])) {
             $addrs[] = $_SERVER['REMOTE_ADDR'];
         }
         $addrs[] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR'];
     }
     foreach ($addrs as $addr) {
         $oct = explode('.', $addr);
         // 10.0.0.0/8   Private network
         // 127.0.0.0/8  Loopback
         // 169.254.0.0/16 & ::1  Link-Local
         // 172.16.0.0/12  Private network
         // 192.168.0.0/16  Private network
         if ($addr !== '::1' && (count($oct) !== 4 || $oct[0] !== '10' && $oct[0] !== '127' && ($oct[0] !== '172' || $oct[1] < 16 || $oct[1] > 31) && ($oct[0] !== '169' || $oct[1] !== '254') && ($oct[0] !== '192' || $oct[1] !== '168'))) {
             return TRUE;
         }
     }
     return FALSE;
 }
开发者ID:kovkus,项目名称:r-cms,代码行数:35,代码来源:Configurator.php


示例19: myIP

 public static function myIP()
 {
     return getHostByName(getHostName());
 }
开发者ID:xoo-berlin,项目名称:janilein,代码行数:4,代码来源:IPs.php


示例20: checkConf

 public static function checkConf($_mode = 'external')
 {
     if ($_mode == 'internal') {
         if (trim(config::byKey('internalComplement')) == '/') {
             config::save('internalComplement', '');
         }
         if (!filter_var(config::byKey('internalAddr'), FILTER_VALIDATE_IP)) {
             $internalAddr = str_replace(array('http://', 'https://'), '', config::byKey('internalAddr'));
             $pos = strpos($internalAddr, '/');
             if ($pos !== false) {
                 $internalAddr = substr($internalAddr, 0, $pos);
             }
             if ($internalAddr != config::byKey('internalAddr') && !netMatch('127.0.*.*', $internalAddr)) {
                 config::save('internalAddr', $internalAddr);
             }
         } else {
             $internalIp = getHostByName(getHostName());
             if (netMatch('127.0.*.*', $internalIp) || $internalIp == '' || !filter_var($internalIp, FILTER_VALIDATE_IP)) {
                 $internalIp = self::getInterfaceIp('eth0');
             }
             if (netMatch('127.0.*.*', $internalIp) || $internalIp == '' || !filter_var($internalIp, FILTER_VALIDATE_IP)) {
                 $internalIp = self::getInterfaceIp('bond0');
             }
             if (netMatch('127.0.*.*', $internalIp) || $internalIp == '' || !filter_var($internalIp, FILTER_VALIDATE_IP)) {
                 $internalIp = self::getInterfaceIp('wlan0');
             }
             if (netMatch('127.0.*.*', $internalIp) || $internalIp == '' || !filter_var($internalIp, FILTER_VALIDATE_IP)) {
                 $internalIp = explode(' ', shell_exec('hostname -I'));
                 $internalIp = $internalIp[0];
             }
             if ($internalIp != '' && filter_var($internalIp, FILTER_VALIDATE_IP) && !netMatch('127.0.*.*', $internalIp)) {
                 config::save('internalAddr', $internalIp);
             }
         }
         if (config::byKey('internalProtocol') == '') {
             config::save('internalProtocol', 'http://');
         }
         if (config::byKey('internalPort') == '') {
             config::save('internalPort', 80);
         }
         if (config::byKey('internalProtocol') == 'https://' && config::byKey('internalPort') == 80) {
             config::save('internalPort', 443);
         }
         if (config::byKey('internalProtocol') == 'http://' && config::byKey('internalPort') == 443) {
             config::save('internalPort', 80);
         }
     }
     if ($_mode == 'external') {
         if ($_mode == 'external' && trim(config::byKey('externalComplement')) == '/') {
             config::save('externalComplement', '');
         }
         if (!filter_var(config::byKey('externalAddr'), FILTER_VALIDATE_IP)) {
             $externalAddr = str_replace(array('http://', 'https://'), '', config::byKey('externalAddr'));
             $pos = strpos($externalAddr, '/');
             if ($pos !== false) {
                 $externalAddr = substr($externalAddr, 0, $pos);
             }
             if ($externalAddr != config::byKey('externalAddr')) {
                 config::save('externalAddr', $externalAddr);
             }
         }
     }
     if (file_exists('/etc/nginx/sites-available/default')) {
         $data = file_get_contents('/etc/nginx/sites-available/default');
         if (strpos($data, 'root /usr/share/nginx/www;') !== false) {
             if ($_mode == 'internal') {
                 config::save('internalComplement', '/jeedom');
             }
             if ($_mode == 'external') {
                 config::save('externalComplement', '/jeedom');
             }
         } else {
             if ($_mode == 'internal') {
                 config::save('internalComplement', '');
             }
             if ($_mode == 'external') {
                 config::save('externalComplement', '');
             }
         }
     }
 }
开发者ID:saez0pub,项目名称:core,代码行数:81,代码来源:network.class.php



注:本文中的getHostByName函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getHostInventories函数代码示例发布时间:2022-05-15
下一篇:
PHP getHostByAddr函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap