當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Service::stop方法代碼示例

本文整理匯總了PHP中Service::stop方法的典型用法代碼示例。如果您正苦於以下問題:PHP Service::stop方法的具體用法?PHP Service::stop怎麽用?PHP Service::stop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Service的用法示例。


在下文中一共展示了Service::stop方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Logger

require_once '../lib/logger.class.php';
$l = new Logger();
$l->log('PHP: ajax/start.php called');
function port_open($port, $host = '127.0.0.1')
{
    $conn = @fsockopen($host, $port, $errno, $errstr, 0.2);
    if ($conn) {
        fclose($conn);
        return false;
    }
    return true;
}
require_once 'environment.class.php';
require_once 'service.class.php';
header("Content-type: text/plain");
Service::stop();
Environment::set_env(array("installed" => false, "vnc_port" => 5900, "policy_host" => $_GET['policy_host'], "policy_port" => 1234, "password" => "", "success" => false, "vnc_port_open" => false, "policy_port_open" => false, "encrypted_password" => ""));
$env = Environment::get_env();
$l->log('Attempting to start the service in the following environment: ' . json_encode($env));
Service::start();
$trys = 0;
$success = false;
$vnc_running = false;
$policy_running = false;
while (!$success && $trys < 20) {
    if (!$vnc_running) {
        $vnc_running = !port_open($env['vnc_port']);
    }
    if (!$policy_running) {
        $policy_running = !port_open($env['policy_port'], $env['policy_host']);
    }
開發者ID:jacobwgillespie,項目名稱:archive,代碼行數:31,代碼來源:start.php

示例2: foreach

<?php

require DIR_CORE . 'services.php';
/** @var array $launch */
foreach ($launch as $s) {
    /** @var array $services */
    if (isset($services[$s])) {
        _echo('Stopping ' . $services[$s]);
        _echo(Service::stop($s));
    } else {
        _echo('Service ' . $s . ' not installed');
    }
}
開發者ID:alorel,項目名稱:alo-wamp,代碼行數:13,代碼來源:stop.php

示例3: stop

 /**
  * @param string $service_id
  * @return string
  * @throws BaseServiceIDMissingException
  * @throws BaseUserAccessDeniedException
  */
 public static function stop($service_id)
 {
     global $user;
     if ($user->is_admin()) {
         if (!is_numeric($service_id)) {
             throw new BaseServiceIDMissingException();
         }
         $service = new Service($service_id);
         if ($service->stop()) {
             return 1;
         } else {
             return 0;
         }
     } else {
         throw new BaseUserAccessDeniedException();
     }
 }
開發者ID:suxinde2009,項目名稱:www,代碼行數:23,代碼來源:admin_base_service.ajax.php


注:本文中的Service::stop方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。