本文整理汇总了PHP中move函数的典型用法代码示例。如果您正苦于以下问题:PHP move函数的具体用法?PHP move怎么用?PHP move使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了move函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: move
/**
* Scripts that can move submission files from the database to the filesystem and back
*/
function move($entity, $submission_path)
{
copy_submissions_for_entity($entity, $submission_path . $entity->path());
foreach ($entity->children() as $child) {
move($child, $submission_path);
}
}
开发者ID:jlsa,项目名称:justitia,代码行数:10,代码来源:move_submission_data.php
示例2: uploaddelete
function uploaddelete($fd_cat_id)
{
$db = new DB_test();
move($fd_cat_id);
//调用回收旧数据函数
$query = "delete from tb_upload_category_list where fd_cat_id='{$fd_cat_id}'";
$db->query($query);
}
开发者ID:Xiaoyuyexi,项目名称:client-server,代码行数:8,代码来源:UploadAction.php
示例3: hanoi
function hanoi($n, $from, $transfrom, $to, &$path)
{
if ($n == 1) {
move(1, $from, $to, $path);
} else {
hanoi($n - 1, $from, $to, $transfrom, $path);
move($n, $from, $to, $path);
hanoi($n - 1, $transfrom, $from, $to, $path);
}
}
开发者ID:dalonghahaha,项目名称:algorithm,代码行数:10,代码来源:Hanoi.php
示例4: removeFilepath
function removeFilepath($id)
{
$dbfile = new DB_file();
move($id);
//调用回收旧数据函数
$query = "delete from tb_category_list where fd_cat_id='{$id}'";
$dbfile->query($query);
//把旧图片移走
$returnvalue = "success";
return $returnvalue;
}
开发者ID:Xiaoyuyexi,项目名称:client-server,代码行数:11,代码来源:AutoGetFilepath.php
示例5: move
function move($n, $a, $b, $c)
{
if ($n == 1) {
echo $a . ' -> ' . $c . ' <br/>';
} else {
move($n - 1, $a, $c, $b);
//第n-1个要从a通过c移动到b
echo $a . ' -> ' . $c . ' <br/>';
move($n - 1, $b, $a, $c);
//n-1个移动过来之后b变开始盘,b通过a移动到c,这边很难理解
}
}
开发者ID:test1960,项目名称:work,代码行数:12,代码来源:Hanoi.php
示例6: build_status_tree
function build_status_tree(&$status_tree, $actions, &$begin_index, &$finish)
{
$begin = $begin_index;
$end = count($status_tree);
$begin_index = count($status_tree);
for ($i = $begin; $i < $end; $i++) {
if ($status_tree[$i]['end']) {
continue;
}
move($status_tree, $i, $actions);
}
if (count($status_tree) == $end) {
$finish = true;
}
}
开发者ID:dalonghahaha,项目名称:algorithm,代码行数:15,代码来源:MonksAndMonsters.php
示例7: move2
function move2($old, $new, $table2, $column, $safe)
{
global $mysqli;
move($old, $safe, $table2, $column);
$stmt = $mysqli->prepare("UPDATE {$table2} SET {$column} = {$column} + 1 WHERE {$column} >= ? AND {$column} < ?");
if (!$stmt) {
echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
}
sql_exec($stmt, ["ii", $new, $old]);
$stmt = $mysqli->prepare("UPDATE {$table2} SET {$column} = ? WHERE {$column} = ?");
if (!$stmt) {
echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
}
sql_exec($stmt, ["ii", $new, $safe]);
$stmt->close();
}
开发者ID:NasalMusician,项目名称:Pantheum,代码行数:16,代码来源:db_reorder.php
示例8: generateSimulationArray
function generateSimulationArray($dimension, $startNrC, $startNrH, $startNrP)
{
$_SESSION["dimension"] = $dimension;
$simulationArray = array();
$simulationday = generateDay0($startNrC, $startNrH, $startNrP);
$simulationArray[] = $simulationday;
do {
$simulationeaten = eat($simulationday);
$simulationloved = love($simulationeaten);
$simulationfaught = fight($simulationloved);
$simulationmoved = move($simulationfaught);
$simulationspawned = spawnOnePlant($simulationmoved);
$simulationday = $simulationspawned;
$simulationArray[] = $simulationday;
} while (count($simulationday) - count(array_keys($simulationday, null)) < $dimension ** 2);
return $simulationArray;
}
开发者ID:Undeci,项目名称:Scrum,代码行数:17,代码来源:simulationFunctions.php
示例9: travel
function travel($endX, $endY, $limit)
{
global $map, $currentX, $currentY;
$map[$currentX][$currentY] = 0;
$move = 1;
while ($move <= $limit) {
move($move);
if ($currentX == $endX && $currentY == $endY) {
echo "Congratulation!<br />";
break;
} else {
if ($move == $limit) {
echo "Sorry, not found!<br />";
}
}
$move++;
}
}
开发者ID:phoe721,项目名称:phoe721.com,代码行数:18,代码来源:moves.php
示例10: simulate
public function simulate()
{
$_SESSION["dimension"] = $_POST["dimension"];
$_SESSION["startNrPlants"] = $_POST["startNrPlants"];
$_SESSION["startNrCarnivores"] = $_POST["startNrCarnivore"];
$_SESSION["startNrHerbivores"] = $_POST["startNrHerbivore"];
if ($_SESSION["startNrPlants"] + $_SESSION["startNrCarnivores"] + $_SESSION["startNrHerbivores"] > $_SESSION["dimension"] ** 2) {
header('location:index_tmp.php?toocrowded=true');
exit(0);
}
$day = 0;
do {
for ($i = 0; $i < $_SESSION["dimension"] ** 2; $i++) {
$_SESSION["action"][] = false;
}
if ($day == 0) {
$simulation[$day] = generateDay0();
$simMatrix[$day] = array_chunk($simulation[$day], $_SESSION["dimension"]);
for ($i = 0; $i < $_SESSION["dimension"]; $i++) {
for ($j = 0; $j < $_SESSION["dimension"]; $j++) {
if ($simMatrix[$day][$i][$j]) {
$_SESSION["simData"][] = array('dimension' => $_SESSION["dimension"], 'day' => $day, 'posx' => $i, 'posy' => $j, 'type' => $simMatrix[$day][$i][$j]['type'], 'lifeforce' => $simMatrix[$day][$i][$j]['life']);
}
}
}
}
$day++;
$simulation[$day] = $simulation[$day - 1];
$simulation[$day] = eat($simulation[$day]);
$simulation[$day] = love($simulation[$day]);
$simulation[$day] = fight($simulation[$day]);
$simulation[$day] = move($simulation[$day]);
$simulation[$day] = spawnOnePlant($simulation[$day]);
$simMatrix[$day] = array_chunk($simulation[$day], $_SESSION["dimension"]);
for ($i = 0; $i < $_SESSION["dimension"]; $i++) {
for ($j = 0; $j < $_SESSION["dimension"]; $j++) {
if ($simMatrix[$day][$i][$j]) {
$_SESSION["simData"][] = array('dimension' => $_SESSION["dimension"], 'day' => $day, 'posx' => $i, 'posy' => $j, 'type' => $simMatrix[$day][$i][$j]['type'], 'lifeforce' => $simMatrix[$day][$i][$j]['life']);
}
}
}
} while (count($simulation[$day]) - count(array_keys($simulation[$day], null)) < $_SESSION["dimension"] ** 2);
return $simMatrix;
}
开发者ID:liesenborghspuntkristof,项目名称:Jurassic_Terrarium,代码行数:44,代码来源:terrarium_temp.php
示例11: Noidedit
function Noidedit($fd_cat_id, $filename, $display = 0, $picurl = 0, $thumurl = 0)
{
$db = new DB_test();
if ($picurl) {
move($dateid, $scatid);
//调用回收旧数据函数
//删除图片
$query = "select *from tb_category_list where fd_cat_dateid='{$dateid}' and fd_cat_scatid='{$scatid}'";
$db->query($query);
$db->next_record();
$url = $db->f(fd_cat_url);
$thumrul = $db->f(fd_cat_thumurl);
@unlink($url);
@unlink($thumrul);
//更新信息
$query = "update tb_category_list set fd_cat_name='{$filename}',\n\t\t\tfd_cat_display='{$display}',fd_cat_url='{$picurl}',fd_cat_time=now(),fd_cat_thumurl='{$thumurl}'\n\t\t\twhere fd_cat_id='{$fd_cat_id}'";
} else {
$query = "update tb_category_list set fd_cat_name='{$filename}',\n\t\t\tfd_cat_display='{$display}',fd_cat_time=now()\n\t\t\twhere fd_cat_id='{$fd_cat_id}'";
}
$db->query($query);
}
开发者ID:Xiaoyuyexi,项目名称:client-server,代码行数:21,代码来源:Getimageid.php
示例12: partTwo
function partTwo($input)
{
$coords = [0, 0];
$roboCoords = [0, 0];
$history = [];
$history[CK] = 0;
$history = updateHistory($coords, $history);
$inputArray = str_split($input);
$santasMove = true;
foreach ($inputArray as $direction) {
if ($santasMove) {
$coords = move($direction, $coords);
$history = updateHistory($coords, $history);
$santasMove = false;
} else {
$roboCoords = move($direction, $roboCoords);
$history = updateHistory($roboCoords, $history);
$santasMove = true;
}
}
return $history[CK];
}
开发者ID:Rory1994,项目名称:AdventOfCode,代码行数:22,代码来源:day3.php
示例13: api_not_allowed
}
if (api_is_coach()) {
if (!DocumentManager::is_visible_by_id($_POST['move_file'], $courseInfo, $sessionId, api_get_user_id())) {
api_not_allowed(true);
}
}
// Get the document data from the ID
$document_to_move = DocumentManager::get_document_data_by_id($_POST['move_file'], api_get_course_id(), false, $sessionId);
// Security fix: make sure they can't move files that are not in the document table
if (!empty($document_to_move)) {
$real_path_target = $base_work_dir . $moveTo . '/' . basename($document_to_move['path']);
$fileExist = false;
if (file_exists($real_path_target)) {
$fileExist = true;
}
if (move($base_work_dir . $document_to_move['path'], $base_work_dir . $moveTo)) {
update_db_info('update', $document_to_move['path'], $moveTo . '/' . basename($document_to_move['path']));
//update database item property
$doc_id = $_POST['move_file'];
if (is_dir($real_path_target)) {
api_item_property_update($courseInfo, TOOL_DOCUMENT, $doc_id, 'FolderMoved', api_get_user_id(), $groupId, null, null, null, $sessionId);
Display::addFlash(Display::return_message(get_lang('DirMv'), 'confirmation'));
} elseif (is_file($real_path_target)) {
api_item_property_update($courseInfo, TOOL_DOCUMENT, $doc_id, 'DocumentMoved', api_get_user_id(), $groupId, null, null, null, $sessionId);
Display::addFlash(Display::return_message(get_lang('DocMv'), 'confirmation'));
}
// Set the current path
$curdirpath = $_POST['move_to'];
$curdirpathurl = urlencode($_POST['move_to']);
} else {
if ($fileExist) {
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:document.php
示例14: post
post($con, $token, $bid, $ip, $attachs);
} else {
if ($ask == "reply") {
reply($con, $token, $bid, $tid, $ip, $attachs);
} else {
if ($ask == "edit") {
edit($con, $token, $bid, $tid, $pid, $ip, $attachs);
} else {
if ($ask == "lock" || $ask == "extr" || $ask == "top") {
threads_action($con, $token, $bid, $tid, $ask);
} else {
if ($ask == "delete") {
delete($con, $token, $bid, $tid, $pid, $ip);
} else {
if ($ask == "move") {
move($con, $token, $bid, $tid, $to);
} else {
if ($ask == "lzl") {
lzl($con, @$_REQUEST['method'], $fid, $token, $ip);
} else {
if ($ask == "getpages") {
getpages($con, $bid, $tid);
} else {
if ($ask == "getlznum") {
getlznum($con, $bid, $tid);
} else {
if ($ask == "getnum") {
getnum($con);
} else {
if ($ask == "sign_today") {
sign_today($con);
开发者ID:hun-tun,项目名称:CAPUBBS,代码行数:31,代码来源:jiekouapi.php
示例15: cr
cr();
break;
case "create":
create($_REQUEST['nfname'], $_REQUEST['isfolder'], $_REQUEST['ndir']);
break;
case "ren":
ren($_REQUEST['file']);
break;
case "rename":
renam($_REQUEST['rename'], $_REQUEST['nrename'], $folder);
break;
case "mov":
mov($_REQUEST['file']);
break;
case "move":
move($_REQUEST['file'], $_REQUEST['ndir'], $folder);
break;
case "printerror":
printerror($error);
break;
case "logout":
logout();
break;
default:
home();
break;
}
/****************************************************************/
/* MISCELLANEAUS */
/* */
/****************************************************************/
开发者ID:vzool,项目名称:php_srrFileManager,代码行数:31,代码来源:index.php
示例16: explode
//print "$message\n";
break;
}
// send out the message to each number
// find out if one or more phone numbers
$numbers = explode(",", $phonenumbers);
if (count($numbers) > 1) {
// more than one number
foreach ($numbers as $key => $value) {
$reply = `echo '{$message}'|{$gnokii} --sendsms {$value}`;
move($file, $outfolder, $sentfolder);
}
} else {
// single number
$reply = `echo '{$message}'|{$gnokii} --sendsms {$phonenumbers}`;
move($file, $outfolder, $sentfolder);
}
}
}
}
closedir($handle);
sleep(1);
`killall -9 gnokii 1>/dev/null 2>/dev/null`;
$target = "{$sentfolder}/*";
`chown -R herman:apache {$target}`;
//
// FETCH MESSAGES FROM PHONE
//
// loop through 14 messages
//
for ($i = 1; $i < 15; $i++) {
开发者ID:wahgithub,项目名称:chits_wah_emr,代码行数:31,代码来源:cronsmsqueue.php
示例17: generateDay0
$simulation[$day] = generateDay0();
$simMatrix[$day] = array_chunk($simulation[$day], $_SESSION["dimension"]);
for ($i = 0; $i < $_SESSION["dimension"]; $i++) {
for ($j = 0; $j < $_SESSION["dimension"]; $j++) {
if ($simMatrix[$day][$i][$j]) {
$_SESSION["simData"][] = array('dimension' => $_SESSION["dimension"], 'day' => $day, 'posx' => $i, 'posy' => $j, 'type' => $simMatrix[$day][$i][$j]['type'], 'lifeforce' => $simMatrix[$day][$i][$j]['life']);
}
}
}
}
$day++;
$simulation[$day] = $simulation[$day - 1];
$simulation[$day] = eat($simulation[$day]);
$simulation[$day] = love($simulation[$day]);
$simulation[$day] = fight($simulation[$day]);
$simulation[$day] = move($simulation[$day]);
$simulation[$day] = spawnOnePlant($simulation[$day]);
$simMatrix[$day] = array_chunk($simulation[$day], $_SESSION["dimension"]);
for ($i = 0; $i < $_SESSION["dimension"]; $i++) {
for ($j = 0; $j < $_SESSION["dimension"]; $j++) {
if ($simMatrix[$day][$i][$j]) {
$_SESSION["simData"][] = array('dimension' => $_SESSION["dimension"], 'day' => $day, 'posx' => $i, 'posy' => $j, 'type' => $simMatrix[$day][$i][$j]['type'], 'lifeforce' => $simMatrix[$day][$i][$j]['life']);
}
}
}
} while (count($simulation[$day]) - count(array_keys($simulation[$day], null)) < $_SESSION["dimension"] ** 2);
include 'presentation_temp.php';
?>
<!--<!DOCTYPE html>
<html>
<head>
开发者ID:liesenborghspuntkristof,项目名称:Jurassic_Terrarium,代码行数:31,代码来源:terrarium_temp.php
示例18: str_split
}
}
$route = "^^<<v<<v><v^^<><>^^<v<v^>>^^^><^>v^>v><><><<vv^^<^>^^<v^>v>v^v>>>^<>v<^<v^><^>>>>><<v>>^>>^>v^>><<^>v>v<>^v^v^vvv><>^^>v><v<><>^><^^<vv^v<v>^v>>^v^>v><>v^<vv>^><<v^>vv^<<>v>>><<<>>^<vv<^<>^^vv>>>^><<<<vv^v^>>><><^>v<>^>v<v^v<^vv><^v^><<<<>^<>v>^v>v<v<v<<>v<^<<<v>>>>>^^v>vv^^<>^<>^^^^<^^^v<v^^>v<^^v^^>v>^v^^^^>><<v<>v<>^v^<v<>><>^^><<^^<^^>vv<>v^<^v<vv<<<>^>^^>^<>v^^vv<>>v><<<>vvv<>v<>><^<^v<>^vv>^^v<v<v><^<>>vv<^>>^>>vv^v<vv^vv<^<<>>^v^<>^>>>>vv>^^>v>vv>v><^vv^<<v>^<<^^<v<v>vv<v^^<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<<v><>^>>>>><v^v<<<^>^v^v<<v<>vvv<<>v>v>>^v^v^>><<<<>v^<v<><<>>>^>>^>><<v>";
$route = str_split($route);
$houses = [new Delivery(0, 0)];
$santaHouse = $houses[0];
$roboHouse = $houses[0];
$santa = true;
foreach ($route as $step) {
$visited = false;
if ($santa) {
$pHouse = $santaHouse;
} else {
$pHouse = $roboHouse;
}
$house = move($step, $pHouse->getX(), $pHouse->getY());
foreach ($houses as $hasBeen) {
if ($hasBeen->getX() == $house->getX() && $hasBeen->getY() == $house->getY()) {
$visited = true;
}
}
if (!$visited) {
array_push($houses, $house);
}
if ($santa) {
$santaHouse = $house;
$santa = false;
} else {
$roboHouse = $house;
$santa = true;
}
开发者ID:iszla,项目名称:adventofcode,代码行数:31,代码来源:advent_day3.php
示例19: actionManager
/**
* It manages the actions which an element can do
*
* @return array|void It depends on the type of action to do
*/
function actionManager(...$args)
{
switch ($args[1]) {
case 'see':
if (canAct($args[0], $args[1])) {
$see = see($args[0]);
useAction($args[0], 'see');
return $see;
} else {
writeFileCSV('Log', array(getTime(), 'It can\'t see, it hasn\'t enough uses', get_class($args[0]), $args[0]->getId(), '[ ' . $args[0]->getPosition()[0] . ' - ' . $args[0]->getPosition()[0] . ' ]', '', 'see', ''));
}
break;
case 'move':
if (canAct($args[0], $args[1])) {
move($args[0], $args[2]);
useAction($args[0], 'move');
} else {
writeFileCSV('Log', array(getTime(), 'It can\'t move, it hasn\'t enough uses', get_class($args[0]), $args[0]->getId(), '[ ' . $args[0]->getPosition()[0] . ' - ' . $args[0]->getPosition()[0] . ' ]', '', 'move', ''));
}
break;
case 'sleep':
if (canAct($args[0], $args[1])) {
toSleep($args[0]);
useAction($args[0], 'sleep');
} else {
writeFileCSV('Log', array(getTime(), 'It can\'t sleep, it hasn\'t enough uses', get_class($args[0]), $args[0]->getId(), '[ ' . $args[0]->getPosition()[0] . ' - ' . $args[0]->getPosition()[0] . ' ]', '', 'sleep', ''));
}
break;
case 'smell':
if (canAct($args[0], $args[1])) {
$smell = smell($args[0]
|
请发表评论