本文整理汇总了PHP中execute函数的典型用法代码示例。如果您正苦于以下问题:PHP execute函数的具体用法?PHP execute怎么用?PHP execute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了execute函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search
public function search($page = 0, $limit = 200)
{
$end = $this->timeEnd ? $this->timeEnd->getTimestamp() : Time::microtime() + 1;
$start = $this->timeStart ? $this->timeStart->getTimestamp() : 0;
$args = array($start, $end, $page * $limit, $limit);
$keys = $this->buildSearchKeys();
if (($keysCount = count($keys)) > 1) {
$args[] = $keysCount;
$keysString = "ARGV[5]";
foreach ($keys as $i => $k) {
$keysString .= " ,KEYS[" . ($i + 2) . "]";
}
$command = "redis.call('zinterstore', KEYS[1], {$keysString}, 'AGGREGATE', 'MAX')" . PHP_EOL;
array_unshift($keys, 'searchtmp:' . uniqid(getmypid() . ':', true));
} else {
$command = "";
count($keys) or $keys[0] = 'index:job:all';
}
// zREVrangebyscore so ARG[2] ARG[1] are reversed
$command .= "local result = redis.call('zrevrangebyscore', KEYS[1], ARGV[2], ARGV[1], 'LIMIT', ARGV[3], ARGV[4])" . PHP_EOL;
$command .= "local count = redis.call('zcount', KEYS[1], ARGV[1], ARGV[2])" . PHP_EOL;
if ($keysCount > 1) {
$command .= "redis.call('del', KEYS[1])" . PHP_EOL;
}
$command .= 'return {count, result}';
list($count, $list) = $this->commandExecutor->execute(new Phresque\Redis\Commands\DynamicCommand($command, $keys, $args));
$jobs = array();
foreach ($list as $jobID) {
$jobs[] = $this->commandExecutor->execute(new Phresque\Redis\Commands\GetJob($jobID));
}
return $this->withCount ? array($jobs, $count) : $jobs;
}
示例2: db_createItemsTable
function db_createItemsTable($con)
{
$sql = "CREATE TABLE items\n (\n IID INT NOT NULL PRIMARY KEY AUTO_INCREMENT, # key to the items table\n OID INT NOT NULL, # key to the orders table\n PKID INT NOT NULL, # key to the packages table\n Personality INT , # foreign key to the pieces table\n Price DECIMAL(6,2) ,\n Quantity INT\n )";
if (!execute($con, $sql, "Table 'items' create")) {
return false;
}
}
示例3: init
/**
* Init function of API.
*/
function init()
{
if ($paramArr = getParam()) {
$repeat = $paramArr[2];
for ($i = 4; $i < 30; $i++) {
$ogListArr = getRandOgList(1, 29, $i, $repeat);
$total1 = 0;
$total2 = 0;
foreach ($ogListArr as $ogList) {
echo json_encode($ogList);
echo '<br>';
$statics = execute($ogList, $paramArr[0], $paramArr[1]);
$total1 += $statics[0]['count'];
$total2 += $statics[1]['count'];
}
$avg1 = $total1 / $repeat;
$avg2 = $total2 / $repeat;
echo '1/2 --- ' . (string) $avg1 . '<br>';
echo '1 --- ' . (string) $avg2 . '<br>';
echo '<br>';
}
} else {
printParamErr();
}
}
示例4: insertTemp
public function insertTemp()
{
$temp = $_REQUEST['temp'];
$date = $_REQUEST['datum'];
$name = strtolower($_REQUEST['name']);
execute("INSERT INTO forecast(date, temp, name) VALUES('{$date}', {$temp}, '{$name}')", $this->mysqli);
}
示例5: getPoke
function getPoke($url)
{
$result = execute($url);
$myfilePkd = fopen("pokedexLib.lua", "w") or die("Unable to open file!");
fwrite($myfilePkd, "PokeDex={");
foreach ($result->objects as $pokedex) {
$txt = "['" . $pokedex->name . "'] = {attack='" . $pokedex->attack . "'," . "catch_rate='" . $pokedex->catch_rate . "'," . "sp_atk='" . $pokedex->sp_atk . "'," . "sp_def='" . $pokedex->sp_def . "'," . "species='" . $pokedex->species . "'," . "defense='" . $pokedex->defense . "'," . "egg_cycles='" . $pokedex->egg_cycles . "'," . "hp='" . $pokedex->hp . "'," . "male_female_ratio='" . $pokedex->male_female_ratio . "'," . "speed='" . $pokedex->speed . "'," . "height='" . $pokedex->height . "'," . "weight='" . $pokedex->weight . "'," . "evolutions={";
foreach ($pokedex->evolutions as $evo) {
if (isset($evo->level)) {
$txt .= "{level='" . $evo->level . "',";
} else {
$txt .= "{level='0',";
}
$txt .= "method='" . $evo->method . "',";
$txt .= "to='" . $evo->to . "'},";
}
$txt .= "},";
$txt .= "types={";
foreach ($pokedex->types as $types) {
$txt .= "{name='" . $types->name . "'},";
}
$txt .= "},";
$txt .= "moves={";
foreach ($pokedex->moves as $move) {
$idAPI = $move->resource_uri;
$IdMove = explode('/', $idAPI);
$txt .= "{id='" . $IdMove[4] . "',";
$txt .= "learn_type='" . $move->learn_type . "',";
$txt .= "name='" . ucwords(strtolower(str_replace("-", " ", $move->name))) . "'},";
}
$txt .= "},\n";
$txt .= "},\n";
fwrite($myfilePkd, $txt);
}
}
示例6: run
public function run()
{
include_once SANWEN_LIB . '/Common/functions.php';
include_used_file();
//include the file that used
Log::write('begin initApp');
$this->initApp();
//use the filter
$filter = new Filter();
//filter all url
Log::write('begin to filter url');
if ($filter->filter_all_url()) {
$include_file = get_include_file();
if (file_exists($include_file)) {
Log::write('get_include_file:' . $include_file);
include_once $include_file;
execute(null, null);
} else {
//对应地址的类不存在的时候,执行默认首页
if (file_exists(APP . '/Index/Action/Index.action.php')) {
include_once APP . '/Index/Action/Index.action.php';
execute("Index", "Index");
} else {
//默认首页不存在的时候,抛出错误信息
echo get_langage_message('system.lang.php', 'DEFAULT_INDEX_NOT_FOUND');
}
}
} else {
echo get_langage_message('system.lang.php', 'CAN_NOT_ACCESS');
}
}
示例7: run_cron
function run_cron()
{
campaign_limit_update();
execute();
update_configvar('last_cron_job', time());
add_syslog('daily_cron', '');
}
示例8: queryOptionsList
function queryOptionsList($query)
{
$result = execute($query);
while ($row = mysql_fetch_row($result)) {
echo "<option value=\"{$row[0]}\">{$row[0]}</option>";
}
}
示例9: init
/**
* Init function of API.
*/
function init()
{
if ($paramArr = getParam()) {
$repeat = $paramArr[0];
for ($i = 1; $i < 101; $i++) {
$halfNum = $i / 100;
for ($j = 4; $j < 29; $j++) {
$ogListArr = getRandOgList(1, 29, $j, $repeat);
$total = 0;
foreach ($ogListArr as $ogList) {
$statics = execute($ogList, $halfNum);
$total += $statics['count'];
}
$avgNumber = $total / $repeat;
echo $avgNumber;
if ($j < 28) {
echo ',';
}
}
echo '<br>';
}
} else {
printParamErr();
}
}
示例10: addUser
function addUser($voornaam, $achternaam, $telefoon, $geslacht, $email, $logonNaam, $wachtwoord)
{
$sql = "INSERT INTO users (user_voornaam, user_achternaam, user_telefoon, user_geslacht, user_email)\nVALUES (?, ?,?,?,?)";
$sql2 = "INSERT INTO users (user_login_naam, user_wachtwoord)\nVALUES (?,?)";
$conn = $getConnection();
$stmt = $conn->prepare($sql);
$stmt->bind_param('s', $voornaam);
$stmt->bind_param('r', $achternaam);
$stmt->bind_param('t', $telefoon);
$stmt->bind_param('u', $geslacht);
$stmt->bind_param('v', $email);
$stmt2 = $conn->prepare($sql2);
$stmt->bind_param('s', $logonNaam);
$stmt->bind_param('r', $wachtwoord);
//laten staan voor debugging voor nu
if ($stmt - execute() === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $stmt->error;
}
if ($stmt2 - execute() === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $stmt2->error;
}
$conn->close();
}
示例11: login_user
public function login_user()
{
//função de login do usuario
$cod = $this->_user_cod;
$login = $this->_user_login;
$pass = $this->_user_pass;
require_once 'config/connection_server.php';
//arquivo de conexao
$sql = "select COD_U,login,senha from usuario where login = :login and senha = :senha";
//comando de pesquisa
$dados = array(':cod_user' => $cod, ':login' => $login, ':login' => $pass);
$query = $banco->prepare($sql);
$query - execute($dados);
if ($query->rowcount() >= 1) {
while ($i = $query->fetch(PDO::FETCH_OBJ)) {
//confirmação de existencia e redirecionando se verdadeiro
if ($login == $i->login && $pass == $i->senha) {
session_start();
$_SESSION['cod'] = $i->cod;
} else {
}
}
} else {
session_start();
$_SESSION['menMenssagem']++;
}
$sql = "insert into usuario_login(COD_UL,cod_usu,horario_login)values(null,:cod_user,null)";
//cod_user vem do $dados na linha 23
$query = $banco->prepare($sql);
$query->execute($dados);
//executa o o sql para sinalizar o login do usuario
header('Location:index2.php');
// redireciona para a pagina de usuario
}
示例12: recvFile
public function recvFile($remote, $local)
{
if (!($info = parse_url($remote))) {
return;
}
if (isset($info['path'])) {
$info = array_merge($info, pathinfo($info['path']));
}
if (!isset($info['filename'])) {
trigger_error('iPlayer: No PID specified', E_USER_WARNING);
return false;
}
if (!isset($info['extension'])) {
trigger_error('iPlayer: No file type (extension) specified', E_USER_WARNING);
return false;
}
if (is_dir($local)) {
$localdir = $local;
$local .= '/' . $info['basename'];
} else {
$localdir = dirname($local);
}
if ($info['extension'] == 'jpg') {
return copy('http://www.bbc.co.uk/iplayer/images/episode/' . $info['filename'] . '_832_468.jpg', $local);
}
if ($info['extension'] == 'rdf') {
return copy('http://www.bbc.co.uk/programmes/' . $info['filename'] . '.rdf', $local);
}
if ($info['extension'] == 'flv') {
$tmpfile = $localdir . '/.iplayer-tmp-' . $info['filename'] . '.flv';
if (!file_exists($tmpfile)) {
$args = array();
$args[] = GET_IPLAYER_PATH;
$args[] = '--flvstreamer';
$args[] = FLVSTREAMER_PATH;
$args[] = '--modes=flashhd1,flashhd2,flashvhigh,flashhigh';
$args[] = '--quiet';
$args[] = '--nocopyright';
$args[] = '--nopurge';
$args[] = '--file-prefix=.iplayer-tmp-' . $info['filename'];
$args[] = '--pid=' . $info['filename'];
$args[] = '--force';
$args[] = '--raw';
$args[] = '-o';
$args[] = $localdir;
$result = execute(GET_IPLAYER_PATH, $args, false);
if (!file_exists($tmpfile)) {
trigger_error('get_iplayer failed to download ' . $info['basename'], E_USER_NOTICE);
return false;
}
}
if (!rename($tmpfile, $local)) {
return false;
}
return true;
}
print_r($info);
die;
}
示例13: init
/**
* Init function of API.
*/
function init()
{
if (($paramArr = getParam()) && validateParam($paramArr[0]) && validateParam($paramArr[1])) {
execute($paramArr[0], $paramArr[1], $paramArr[2]);
} else {
printParamErr();
}
}
示例14: init
/**
* Init function of API.
*/
function init()
{
if (($idArr = parseParam()) && validateParam($idArr)) {
execute($idArr);
} else {
printParamErr();
}
}
示例15: execute
public function execute()
{
if (execute('which traceroute') != '') {
echo execute('traceroute ' . escapeshellarg(CenterBot::getInstance()->_actionText));
} else {
echo 'Error: system comand (traceroute) not found';
}
}