当前位置: 首页>>代码示例>>PHP>>正文


PHP cmd函数代码示例

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


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

示例1: testExecute

 public function testExecute()
 {
     $uniq = uniqid('', true);
     $output = cmd('php ./bin/jbzoo test', array('option' => $uniq));
     isContain($uniq, $output);
     isContain('qwerty', $output);
     isContain('Success', $output);
 }
开发者ID:JBZoo,项目名称:Console,代码行数:8,代码来源:AppTest.php

示例2: resetlink_get

function resetlink_get()
{
    global $Security, $DB;
    if (id() && $Security->is_admin(session('id')) && md5(session_id()) == cmd(3)) {
        $DB->query("SELECT email_signup||pass FROM member WHERE id=\$1", array(id()));
        $hash = md5($DB->load_result() . time());
        $DB->update("member", "id", id(), array("reset" => $hash));
        print "http://{$_SERVER['HTTP_HOST']}/member/reset/{$hash}/";
    }
    exit_clean();
}
开发者ID:jmichaelward,项目名称:pgBoard,代码行数:11,代码来源:get.php

示例3: main_entry

function main_entry($uid)
{
    if ($uid == "") {
        return "No Child UID !!";
    }
    /* Check parent is up or not*/
    if (isfile("/var/run/CHILD." . $uid . ".UP") == 1) {
        cmd("service INET." . $uid . " stop");
    } else {
        msg("Child interface already stopped. Do nothing.");
    }
}
开发者ID:jhbsz,项目名称:DIR-850L_A1,代码行数:12,代码来源:stopchild.php

示例4: exec

	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		$object = new mObject(getNode($_SESSION['murrix']['path']));
		$links = $object->getLinks();
		
		if ($args == "-l")
		{
			$stdout .= "total ".count($links)."\n";
			if (count($links) > 0)
			{
				$stdout .= "<table cellspacing=\"0\">";
				$stdout .= "<tr class=\"table_title\">";
				$stdout .= "<td>Id</td>";
				$stdout .= "<td>Type</td>";
				$stdout .= "<td>Remote node</td>";
				$stdout .= "<td>Remote node is on...</td>";
				$stdout .= "</tr>";
				foreach ($links as $link)
				{
					if ($link['remote_id'] <= 0)
						$remote = ucf(i18n("unknown"));
					else
					{
						$remote_obj = new mObject($link['remote_id']);
						$remote = cmd(img(geticon($remote_obj->getIcon()))."&nbsp;".$remote_obj->getName(), "exec=show&node_id=".$remote_obj->getNodeId());
					}
	
					$stdout .= "<tr>";
					$stdout .= "<td>".$link['id']."</td>";
					$stdout .= "<td>".$link['type']."</td>";
					$stdout .= "<td>".$remote."</td>";
					$stdout .= "<td>".ucf(i18n($link['direction']))."</td>";
					$stdout .= "</tr>";
				}
				$stdout .= "</table>";
			}
		}
		else
		{
			foreach ($links as $link)
			{
				if ($link['remote_id'] > 0)
				{
					$remote_obj = new mObject($link['remote_id']);
					$stdout .= cmd($remote_obj->getName(), "exec=show&node_id=".$remote_obj->getNodeId())." ";
				}
			}
		}
		
		return true;
	}
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:51,代码来源:llist.php

示例5: exec

	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		$group = new mGroup();
		$groups = $group->getList();
		
		if ($args == "-l")
		{
			$stdout .= "total ".count($groups)."\n";
			if (count($groups) > 0)
			{
				$stdout .= "<table cellspacing=\"0\">";
				$stdout .= "<tr class=\"table_title\">";
				$stdout .= "<td>Id</td>";
				$stdout .= "<td>Name</td>";
				$stdout .= "<td>Home</td>";
				$stdout .= "<td>Created</td>";
				$stdout .= "<td>Description</td>";
				$stdout .= "</tr>";
				foreach ($groups as $group)
				{
					$stdout .= "<tr>";
					$stdout .= "<td>".$group->id."</td>";
					$stdout .= "<td>".$group->name."</td>";
					
					if ($group->home_id > 0)
					{
						$home = new mObject($group->home_id);
						$stdout .= "<td>".cmd($home->getPath(), "exec=show&node_id=".$home->getNodeId())."</td>";
					}
					else
						$stdout .= "<td></td>";
					
					$stdout .= "<td>".$group->created."</td>";
					$stdout .= "<td>".$group->description."</td>";
					$stdout .= "</tr>";
				}
				$stdout .= "</table>";
			}
		}
		else
		{
			foreach ($groups as $group)
				$stdout .= $group->name." ";
		}
		
		return true;
	}
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:47,代码来源:glist.php

示例6: exec

	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		$object = new mObject(getNode($_SESSION['murrix']['path']));
		$children = fetch("FETCH node WHERE link:node_top='".$object->getNodeId()."' AND link:type='sub' NODESORTBY property:version SORTBY ".$object->getMeta("sort_by", "property:name"));
		
		if ($args == "-l")
		{
			$stdout .= "total ".count($children)."\n";
			if (count($children) > 0)
			{
				$stdout .= "<table cellspacing=\"0\">";
				$stdout .= "<tr class=\"table_title\">";
				$stdout .= "<td>Id</td>";
				$stdout .= "<td>Rev.</td>";
				$stdout .= "<td>Lang.</td>";
				$stdout .= "<td>Class</td>";
				$stdout .= "<td>Rights</td>";
				$stdout .= "<td>User</td>";
				$stdout .= "<td>Time</td>";
				$stdout .= "<td>Name</td>";
				$stdout .= "</tr>";
				foreach ($children as $child)
				{
					$user = $child->getUser();
					
					$stdout .= "<tr>";
					$stdout .= "<td>".$child->getNodeId()."</td>";
					$stdout .= "<td>".$child->getVersion()."</td>";
					$stdout .= "<td>".$child->getLanguage()."</td>";
					$stdout .= "<td>".$child->getClassName()."</td>";
					$stdout .= "<td>".$child->getRights()."</td>";
					$stdout .= "<td>".$user->username."</td>";
					$stdout .= "<td>".$child->getCreated()."</td>";
					$stdout .= "<td>".cmd(img(geticon($child->getIcon(), 16))."&nbsp;".$child->getName(), "exec=show&node_id=".$child->getNodeId())."</td>";
					$stdout .= "</tr>";
				}
				$stdout .= "</table>";
			}
		}
		else
		{
			foreach ($children as $child)
				$stdout .= $child->getName()." ";
		}
		
		return true;
	}
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:47,代码来源:olist.php

示例7: main_entry

function main_entry($inf, $devnam, $ipaddr, $prefix)
{
    $ipv6enable = fread("e", "/proc/sys/net/ipv6/conf/" . $devnam . "/disable_ipv6");
    if ($ipv6enable == "0") {
        msg("Set ULA ... ");
        /* Start script */
        cmd("phpsh /etc/scripts/IPV6.INET.php ACTION=ATTACH" . " MODE=UL" . " INF=" . $inf . " DEVNAM=" . $devnam . " IPADDR=" . $ipaddr . " PREFIX=" . $prefix);
    } else {
        /* Generate wait script. */
        $enula = "/var/servd/INET." . $inf . "-enula.sh";
        fwrite(w, $enula, "#!/bin/sh\n" . "phpsh /etc/scripts/ENULA.php" . " INF=" . $inf . " DEVNAM=" . $devnam . " IPADDR=" . $ipaddr . " PREFIX=" . $prefix . "\n");
        /* Start script ... */
        cmd("chmod +x " . $enula);
        cmd('xmldbc -t "enula.' . $inf . ':5:' . $enula . '"');
    }
    return 0;
}
开发者ID:jhbsz,项目名称:DIR-850L_A1,代码行数:17,代码来源:ENULA.php

示例8: exec

	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		$args = str_replace("*", "%", $args);
		
		$children = fetch("FETCH node WHERE property:name LIKE '%$args%' NODESORTBY property:version SORTBY property:name");
		$children = getReadable($children);
		
		$stdout .= "total ".count($children)."\n";
		if (count($children) > 0)
		{
			$stdout .= "<table cellspacing=\"0\">";
			$stdout .= "<tr class=\"table_title\">";
			$stdout .= "<td>Id</td>";
			$stdout .= "<td>Rev.</td>";
			$stdout .= "<td>Lang.</td>";
			$stdout .= "<td>Class</td>";
			$stdout .= "<td>Rights</td>";
			$stdout .= "<td>User</td>";
			$stdout .= "<td>Group</td>";
			$stdout .= "<td>Time</td>";
			$stdout .= "<td>Name</td>";
			$stdout .= "</tr>";
			foreach ($children as $child)
			{
				$user = $child->getUser();
				$group = $child->getGroup();
				
				$stdout .= "<tr>";
				$stdout .= "<td>".$child->getNodeId()."</td>";
				$stdout .= "<td>".$child->getVersion()."</td>";
				$stdout .= "<td>".$child->getLanguage()."</td>";
				$stdout .= "<td>".$child->getClassName()."</td>";
				$stdout .= "<td>".$child->getRights()."</td>";
				$stdout .= "<td>".$user->username."</td>";
				$stdout .= "<td>".$group->name."</td>";
				$stdout .= "<td>".$child->getCreated()."</td>";
				$stdout .= "<td>".cmd(img(geticon($child->getIcon(), 16))."&nbsp;".$child->getName(), "exec=show&node_id=".$child->getNodeId())."</td>";
				$stdout .= "</tr>";
			}
			$stdout .= "</table>";
		}
		return true;
	}
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:43,代码来源:search.php

示例9: createHost

function createHost($dev)
{
    global $community;
    global $hosttemplate;
    print "================== Creating DSLAM for {$dev} =======================\n";
    $ret = cmd("/usr/bin/php add_device.php --quiet --description='" . $dev . "' --ip='{$dev}.{$localdomain} --template={$hosttemplate} --community='" . $community . "' --avail=snmp");
    //Get host id from: [RET] Success - new device-id: (20)
    if (preg_match("/\\((\\d+)\\)/", $ret, $matches)) {
        $deviceID = $matches[1];
        print "Device ID: {$deviceID} \n";
        //We got a device - create graphs for device
        $ret = cmd("/usr/bin/php add_graphs.php --graph-type=ds --graph-template-id='31' --host-id=" . $deviceID . " --snmp-query-id={$snmpqueryid} --snmp-query-type-id={$snmpquerytype} --snmp-field=ifDescr --snmp-value='Ethernet\n Interface'");
        //RET: Graph Added - graph-id: (34) - data-source-ids: (37, 37)
        if (preg_match("/\\((\\d+)\\)/", $ret, $matches)) {
            $graphID = $matches[1];
            //We got a graph - add it to default tree
            #                       cmd("/usr/bin/php /cacti/appl/cacti/cli/add_tree.php  --type=node  --node-type=graph --tree-id=1 --graph-id=".$graphID);
        }
    }
}
开发者ID:pertoft,项目名称:Cacti-scripts,代码行数:20,代码来源:bulk-create-devices.php

示例10: exec

	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		$object = new mObject(getNode($_SESSION['murrix']['path']));

		$user = $object->getUser();
			
		$stdout .= "<table cellspacing=\"0\">";
		$stdout .= "<tr><td class=\"titlename\">Name</td><td>".cmd($object->getName(), "exec=show'&node_id=".$object->getNodeId())."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">Icon</td><td>".img(geticon($object->getIcon(), 16))."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">Id</td><td>".$object->getNodeId()."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">Revision</td><td>".$object->getVersion()."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">Language</td><td>".$object->getLanguage()."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">Class</td><td>".$object->getClassName()."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">Rights</td><td>".$object->getRights()."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">User</td><td>".$user->username."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">Time</td><td>".$object->getCreated()."</td></tr>";
		$stdout .= "</table>";
		
		return true;
	}
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:20,代码来源:oinfo.php

示例11: thread_post_get

function thread_post_get()
{
    global $DB;
    $Search = new Search();
    $offset = cmd(3, true) ? cmd(3, true) * 100 : 0;
    $res = $Search->query(cmd(2), "thread_post", $offset);
    $ids = array_keys($res['matches']);
    $page = cmd(3, true) + 1;
    $Query = new BoardQuery();
    $View = new BoardView();
    $View->type(VIEW_THREAD_SEARCH);
    $View->title("Search Thread Posts: " . htmlentities(cmd(2)));
    $View->subtitle(number_format($res['total']) . " results found showing " . ($offset ? $offset : 1) . "-" . ($offset + 100) . SPACE . ARROW_RIGHT . SPACE . "page: {$page}");
    $View->header(false);
    require_once DIR . "module/search/.content/main.php";
    $View->header_menu();
    if ($res['total'] == 0) {
        $ids = array(0);
    }
    $DB->query($Query->view_thread(false, cmd(3, true), cmd(4, true), $ids));
    $View->data($DB->load_all());
    $View->thread();
    $View->footer();
}
开发者ID:jmichaelward,项目名称:pgBoard,代码行数:24,代码来源:get.php

示例12: array

<?
$args_title = array();
$args_title['left'] = img(geticon("comment"))."&nbsp;".ucf(i18n("comments"));
if ($object->hasRight("create") || $object->hasRight("comment"))
	$args_title['right'] = cmd(img(geticon("comment"))."&nbsp;".ucf(i18n("post")), "exec=new&node_id=".$object->getNodeId()."&class_name=comment");

echo compiletpl("title/medium", $args_title, $object);

$pagername = "comments_show";
$children = fetch("FETCH node WHERE link:node_top='".$object->getNodeId()."' AND link:type='sub' AND property:class_name='comment' NODESORTBY property:version SORTBY !property:created");

$children = getReadable($children);

if (count($children) > 0)
{
	include(gettpl("pager/start", $object));

	for ($i = $start; $i < $end; $i++)
		echo compiletpl("scripts/show/line", array(), $children[$i]);

	include(gettpl("pager/end", $object));
}
?>
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:23,代码来源:comments.php

示例13: cmd

<?php 
function cmd($command)
{
    exec($command, $output);
    return $output;
}
$action = !empty($_GET['action']) ? $_GET['action'] : null;
switch ($action) {
    case 'start':
        $result = cmd('sudo /etc/init.d/botty start');
        break;
    case 'stop':
        $result = cmd('sudo /etc/init.d/botty stop');
        break;
    case 'restart':
        $result = cmd('sudo /etc/init.d/botty restart');
        break;
    default:
        $result = null;
}
?>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="I am in each channel on slack, even if you do not see me. Talk to me by start a message with @T3Bot or with the command prefix.">
    <meta name="author" content="Frank Nägler">
    <link rel="apple-touch-icon" sizes="57x57" href="/Resources/Public/Assets/apple-touch-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="114x114" href="/Resources/Public/Assets/apple-touch-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="72x72" href="/Resources/Public/Assets/apple-touch-icon-72x72.png">
开发者ID:NeoBlack,项目名称:T3Bot,代码行数:31,代码来源:index.php

示例14: super_file

function super_file($access_token, $path, $localfile, $ondup = 'newcopy', $sbyte = 1073741824, $temp_dir = '/tmp/')
{
    //调用split命令进行切割
    //split -b200 --verbose rubygems-1.8.25.zip rg/rg1
    if (filesize($localfile) <= $sbyte) {
        echon('The file isn\'t big enough to split up. Proceed to upload normally.');
        upload_file($access_token, $path, $localfile, $ondup);
        //直接上传
    }
    $tempfdir = rtrim($temp_dir, '/') . '/' . uniqid('bpcs_to_upload_');
    if (!mkdir($tempfdir, 0700, true)) {
        echon('Cannot create temp dir:' . $tempfdir);
        die(9009);
    }
    $splitcmd = "split -b{$sbyte} {$localfile} {$tempfdir}/bpcs_toupload_";
    $splitresult = cmd($splitcmd);
    if (trim($splitresult)) {
        echon('Split exited with message:' . $splitresult);
    }
    //遍历临时文件目录
    $tempfiles = glob($tempfdir . '/bpcs_toupload_*');
    if (count($tempfiles) < 1) {
        //没有生成文件
        echon('There are no files to be upload.');
        die(9010);
    } elseif (count($tempfiles) == 1) {
        //只有一个文件
        unlink($tempfiles[0]);
        //删除它
        echon('The file isn\'t big enough to split up. Proceed to upload normally.');
        upload_file($access_token, $path, $localfile, $ondup);
        //直接上传
        return;
    }
    //开始上传进程
    $block_list = array();
    $count = 0;
    foreach ($tempfiles as $tempfile) {
        //上传临时文件,上传API与上传普通文件无异,只是多一个参数type=tmpfile,取消了其它几个参数。此处将“&type=tmpfile”作为ondup传递,将参数带在请求尾部。
        echon('Uploading file in pieces, ' . ($count + 1) . ' out of ' . count($tempfiles) . ' parts... ');
        $count++;
        $upload_res = upload_file($access_token, '', $tempfile, $ondup . '&type=tmpfile');
        $block_list[] = $upload_res['md5'];
        //删除临时文件
        unlink($tempfile);
    }
    //删除临时文件夹
    rmdir($tempfdir);
    //准备提交API
    $block_list = json_encode($block_list);
    $param = '{"block_list":' . $block_list . '}';
    $param = 'param=' . urlencode($param);
    $path = getpath($path);
    $url = "https://pcs.baidu.com/rest/2.0/file?method=createsuperfile&path={$path}&access_token={$access_token}";
    $res = do_api($url, $param);
}
开发者ID:cclient,项目名称:bpcs_uploader,代码行数:56,代码来源:core.php

示例15: unserialize

<?php

global $Style;
global $Core;
if (cmd(2)) {
    $theme_member_id = $Core->idfromname(cmd(2));
    if ($theme_member_id) {
        $theme = $Core->member_pref($theme_member_id, "theme");
        if ($theme) {
            $Style->set_theme($theme);
        } else {
            $Style->load_default();
        }
    }
} else {
    if (get('theme')) {
        if ($theme = $DB->value("SELECT value FROM theme WHERE name=\$1", array(get('theme')))) {
            $Style->set_theme($theme);
        }
    }
}
$theme = unserialize($Style->theme);
foreach ($theme as $type => $val) {
    if (substr($val, 0, 1) == "#") {
        $theme[$type] = substr($val, 1);
    }
}
$fontsizes = array("1" => "10pt", "1.1" => "11pt", "1.2" => "12pt", "1.3" => "13pt", "1.4" => "14pt");
?>
<!--
Copyright (c) 2007 John Dyer (http://johndyer.name)
开发者ID:jmichaelward,项目名称:pgBoard,代码行数:31,代码来源:editcolors.php


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