本文整理汇总了PHP中Service::start方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::start方法的具体用法?PHP Service::start怎么用?PHP Service::start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Service
的用法示例。
在下文中一共展示了Service::start方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start
/**
* @param string $service_id
* @return string
* @throws BaseServiceIDMissingException
* @throws BaseUserAccessDeniedException
*/
public static function start($service_id)
{
global $user;
if ($user->is_admin()) {
if (!is_numeric($service_id)) {
throw new BaseServiceIDMissingException();
}
$service = new Service($service_id);
if ($service->start()) {
return 1;
} else {
return 0;
}
} else {
throw new BaseUserAccessDeniedException();
}
}
示例2: fclose
{
$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']);
}
if ($vnc_running && $policy_running) {
$success = true;
}
$trys++;
示例3: foreach
<?php
require DIR_CORE . 'services.php';
/** @var array $launch */
foreach ($launch as $s) {
/** @var array $services */
if (isset($services[$s])) {
_echo('Starting ' . $services[$s]);
_echo(Service::start($s));
} else {
_echo('Service ' . $s . ' not installed');
}
}