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

PHP getHostName函数代码示例

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

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



在下文中一共展示了getHostName函数的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: testCurlTransport

 public function testCurlTransport()
 {
     $mail = new Mail();
     $mail->setTo('[email protected]');
     $headers = $mail->getHeaders();
     $headers->set('To', '[email protected]');
     $headers->set('X-Foo', 23);
     $headers->set('X-Bar', 42);
     $headers->set('X-Foo-Bar', 1337);
     if (getEnv('TRAVIS')) {
         $from = new MailAddress();
         $from->setMailbox(getEnv('USER'));
         $from->setHostName(getHostName());
         $headers->set('From', $from);
         $headers->set('Subject', sprintf('%s #%s (%s)', getEnv('TRAVIS_REPO_SLUG'), getEnv('TRAVIS_JOB_NUMBER'), __METHOD__));
         $headers->set('Content-Type', 'text/plain');
         $mail->push(sprintf("Repository: %s\nJob: %s\nCommit: %s\nCommit-Range: %s\nPHP-Version: %s\n", getEnv('TRAVIS_REPO_SLUG'), getEnv('TRAVIS_JOB_NUMBER'), getEnv('TRAVIS_COMMIT'), getEnv('TRAVIS_COMMIT_RANGE'), getEnv('TRAVIS_PHP_VERSION')));
     } else {
         $headers->set('From', '[email protected]');
         $mail->push("Hello World");
     }
     $credentials = getEnv('MAILTRAP_SMTP_CREDENTIALS');
     if (!$credentials) {
         $this->markTestSkipped('Credentials for Mailtrap not found!');
     }
     $credentials = explode(':', $credentials, 2);
     $transport = new CurlTransport('mailtrap.io', 2525);
     $transport->setCredentials($credentials[0], $credentials[1]);
     $transport->sendMail($mail);
     # $this->markTestIncomplete('Check sent mail via Mailtrap is not implemented');
 }
开发者ID:blar,项目名称:mail,代码行数:31,代码来源:MailTest.php


示例3: 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


示例4: getConfigFilename

 function getConfigFilename()
 {
     $variablesScriptPath = $this->installPath . '/variables.php';
     if (!file_exists($variablesScriptPath)) {
         return null;
     }
     require_once $variablesScriptPath;
     return $this->installPath . '/var/' . getHostName() . '.conf.php';
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:9,代码来源:OpenAdsConnection.inc.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: getLocalIp

 public static function getLocalIp()
 {
     if (empty($_SERVER['SERVER_ADDR']) == false) {
         return $_SERVER['SERVER_ADDR'];
     } else {
         if (self::isCLI() == true) {
             return getHostName();
         } else {
             return null;
         }
     }
 }
开发者ID:benconnito,项目名称:kopper,代码行数:12,代码来源:Utility.php


示例8: setRating

 function setRating($objId, $rating, $remoteData = array())
 {
     global $db, $page, $user;
     // checks
     if (!is_numeric($rating) || $rating < $this->minValue || $rating > $this->maxValue) {
         addError("invalid or empty rating");
         return;
     }
     if (!empty($remoteData)) {
         // this rating comes from another node...
         // TODO
     } elseif ($page->loggedIn()) {
         // local rating from registered user
         $this->find($objId, $user->id);
         $this->set('rate', $rating);
         $this->set('host', getHostName());
         $this->set('entered', $this->db->getTimestampTz());
         if ($this->exists()) {
             // change existing rating
             $this->update();
         } else {
             // new rating
             $this->set('prog_id', $objId);
             $this->set('user_id', $user->id);
             $this->set('user_node_id', 0);
             $this->create();
         }
     } else {
         // anonymous rating
         // TODO: if there was a rating request from the same host within x minutes, then reject
         $key = $page->getAuthKey();
         if ($key) {
             $this->findAnon($objId, $key);
             $this->set('rate', $rating);
             $this->set('host', getHostName());
             $this->set('entered', $this->db->getTimestampTz());
             if ($this->exists()) {
                 // change existing rating
                 $this->update();
             } else {
                 // new rating
                 $this->set('prog_id', $objId);
                 $this->set('auth_key', $key);
                 $this->create();
             }
         } else {
             addError($page->getlocalized("cannot_rate_no_authkey"));
             // or $this->set('problem', 'no_auth_key');
             return;
         }
     }
     $this->updateInstant($objId);
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:53,代码来源:sotf_Rating.class.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: logger

/** this creates a log entry */
function logger($name, $msg = '', $type = 'default')
{
    if ($type == 'default') {
        $type = $debug_type;
    }
    if (is_array($msg)) {
        ob_start();
        //var_dump($msg);
        print_r($msg);
        $msg = "\n" . ob_get_contents();
        ob_end_clean();
    }
    error_log(getHostName() . ": {$name}: {$msg}", 0);
    if ($type == 'now' && headers_sent()) {
        echo "<small><pre> Debug: {$name}: {$msg} </pre></small><br>\n";
    }
}
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:18,代码来源:functions.inc.php


示例13: 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


示例14: debug

/** this creates a log entry if $debug is true*/
function debug($name, $msg = '', $type = 'default')
{
    global $debug, $debug_type;
    if ($debug) {
        // the $debug_type is set in config.inc.php
        if ($type == 'default') {
            $type = $debug_type;
        }
        if (is_array($msg)) {
            ob_start();
            var_dump($msg);
            $msg = "\n" . ob_get_contents();
            ob_end_clean();
        }
        error_log(getHostName() . ": {$name}: {$msg}", 0);
        if ($type == 'now' && headers_sent()) {
            echo "<small><pre> Debug: {$name}: {$msg} </pre></small><br>\n";
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:21,代码来源:init.inc.php


示例15: 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


示例16: 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


示例17: testSameIPIsLocal

 /**
  * Test running migration.
  *
  * @test
  */
 public function testSameIPIsLocal()
 {
     // Initialize the connection variables we'll need
     $this->port = Config::get('lxmpd::port');
     $this->password = Config::get('lxmpd::password');
     $hostname = getHostName();
     $ip = getHostByName($hostname);
     // Test that determine is local returns true for the ip of the server
     $connection = new MPDConnection($ip, $this->port, $this->password);
     $connection->establish();
     // Determine if the connection is local
     $connection->determineIfLocal();
     // Check if the connection was marked as local
     $result = $connection->local;
     // Check if the result is true
     $this->assertEquals(true, $result);
 }
开发者ID:xnum,项目名称:lxmpd,代码行数:22,代码来源:MPDIsLocalTest.php


示例18: getIpAddress

 /**
  * 
  * Iegūst klienta IP adresi
  * 
  * @return string Klienta IP adrese
  */
 private function getIpAddress()
 {
     return getHostByName(getHostName());
 }
开发者ID:mindwo,项目名称:pages,代码行数:10,代码来源:Block_DAILYQUEST.php


示例19: generateMainPages

 /**
  * Generates the index page and style guide
  */
 protected function generateMainPages()
 {
     // make sure $this->mfs & $this->mv are refreshed
     $this->loadMustacheFileSystemLoaderInstance();
     $this->loadMustacheVanillaInstance();
     // get the source pattern paths
     $patternPathDests = array();
     foreach ($this->patternPaths as $patternType => $patterns) {
         $patternPathDests[$patternType] = array();
         foreach ($patterns as $pattern => $patternInfo) {
             if ($patternInfo["render"]) {
                 $patternPathDests[$patternType][$pattern] = $patternInfo["patternDestPath"];
             }
         }
     }
     // render out the main pages and move them to public
     $this->navItems['autoreloadnav'] = $this->autoReloadNav;
     $this->navItems['autoreloadport'] = $this->autoReloadPort;
     $this->navItems['pagefollownav'] = $this->pageFollowNav;
     $this->navItems['pagefollowport'] = $this->pageFollowPort;
     $this->navItems['patternpaths'] = json_encode($patternPathDests);
     $this->navItems['viewallpaths'] = json_encode($this->viewAllPaths);
     $this->navItems['mqs'] = $this->gatherMQs();
     $this->navItems['qrcodegeneratoron'] = $this->qrCodeGeneratorOn;
     $this->navItems['ipaddress'] = getHostByName(getHostName());
     $this->navItems['xiphostname'] = $this->xipHostname;
     $this->navItems['ishminimum'] = $this->ishMinimum;
     $this->navItems['ishmaximum'] = $this->ishMaximum;
     $this->navItems['ishControlsHide'] = $this->ishControlsHide;
     // grab the partials into a data object for the style guide
     $sd = array("partials" => array());
     foreach ($this->patternPartials as $patternSubtypes) {
         foreach ($patternSubtypes as $patterns) {
             $sd["partials"][] = $patterns;
         }
     }
     // render the "view all" pages
     $this->generateViewAllPages();
     // add cacheBuster info
     $this->navItems['cacheBuster'] = $this->cacheBuster;
     $sd['cacheBuster'] = $this->cacheBuster;
     // render the index page
     $r = $this->mfs->render('index', $this->navItems);
     file_put_contents($this->pd . "/index.html", $r);
     // render the style guide
     $sd = array_replace_recursive($this->d, $sd);
     $styleGuideHead = $this->mv->render($this->mainPageHead, $sd);
     $styleGuideFoot = $this->mv->render($this->mainPageFoot, $sd);
     $styleGuidePage = $styleGuideHead . $this->mfs->render('viewall', $sd) . $styleGuideFoot;
     if (!file_exists($this->pd . "/styleguide/html/styleguide.html")) {
         print "ERROR: the main style guide wasn't written out. make sure public/styleguide exists. can copy core/styleguide\n";
     } else {
         file_put_contents($this->pd . "/styleguide/html/styleguide.html", $styleGuidePage);
     }
 }
开发者ID:Jemok,项目名称:ba_hosting,代码行数:58,代码来源:Builder.php


示例20: logRequest

 function logRequest()
 {
     global $config, $startTime, $totalTime, $PHP_SELF;
     $host = getHostName();
     error_log("{$host}: {$totalTime} ms, " . myGetenv("REQUEST_URI"), 0);
     if ($config['debug']) {
         error_log("--------------------------------------------------------------------", 0);
     }
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:9,代码来源:sotf_Page.class.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP getHostOS函数代码示例发布时间:2022-05-15
下一篇:
PHP getHostInventories函数代码示例发布时间: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