本文整理汇总了PHP中save函数的典型用法代码示例。如果您正苦于以下问题:PHP save函数的具体用法?PHP save怎么用?PHP save使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了save函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: adddummypost
public function adddummypost()
{
$validator = Validator::make(array('count' => $count), array('count' => 'required|integer'));
for ($i = 0; $i < $count; $i++) {
$title = $i . "Penny The Miracle Pup Celebrates A Birthday No One Thought She Would Live To See";
$post = new Posts();
$post->title = $title;
$post->image = 'http://awsd007-atpict.rhcloud.com/uploads/penny-the-miracle-pup-celebrates-a-birthday-no-one-thought-she-would-live-to-see-1457978235.jpg';
$post->des = 'Candice a devoted rescue and foster pawrent rescued Penny who was Born to an inexperienced mother bred too soon Penny was the only pup in her litter of five to make it to four-days-old.Now Penny has now grown bigger and stronger and is a year old and as hearty as can be Meanwhile Candice is devoting her life to transform the 12-acre ranch into a rescue and rehab facility for dogs.';
$post->category = '17,1';
$post->link = 'penny-the-miracle-pup-celebrates-a-birthday-no-one-thought-she-would-live-to-see-70';
$post->url = 'http://barkpost.com/good/pup-celebrates-birthday-no-one-thought-she-would-see';
$post->created_at = '2016-03-15 00:20:00';
$post->updated_at = '2016-03-30 04:42:28';
$post->is_approved = 1;
$post->title_tag = 'Penny Birthday';
$post->meta_des = 'Penny the miracle puppy';
$post->timestamp = 'hi';
$post->share_cat = 1;
$post->author = 'admin';
$post->publisher = 1;
$post->user_id = 2;
$post->publisher_id = 1;
$post->share_title = 'penny-the-miracle-pup-celebrates-a-birthday-no-one-thought-she-would-live-to-see';
$post . save();
}
}
示例2: publish
function publish($table, $menu)
{
global $mysql;
// get the new menu
$section = $_POST['menu'];
$menu = $_POST['menu'];
$title = $_POST['title'];
// CLEAR CURRENT TABLE
$sql = "TRUNCATE TABLE " . $table;
$query = $mysql->sql_query($sql);
// INSERT NEW DATA IN THE TABLE
$fields = array('type', 'txt_fr', 'txt_en', 'price');
$insert = array();
foreach ($_POST['type'] as $key => $_) {
$item = array();
foreach ($fields as $field) {
$var = $_POST[$field][$key];
$value = $var ? '\'' . mysqli_real_escape_string($mysql->cndb, stripslashes($var)) . '\'' : 'NULL';
array_push($item, $value);
}
array_push($insert, '(' . implode(',', $item) . ')');
}
$sql = 'INSERT INTO ' . $table . ' (' . implode(',', $fields) . ') VALUES ' . implode(',', $insert) . ';';
$query = $mysql->sql_query($sql);
write($table, 2);
save($table, $menu);
}
示例3: addQuestion
public function addQuestion($title, $type)
{
$q = new QuestionRecord(array('poll_id' => $this->data['id'], 'title' => $title, 'type' => $type));
$questions[] = $q;
$q . save();
return $q;
}
示例4: update
public function update(EditAsignaturasCursadasRequest $request, $id)
{
$cursadas = AsignaturaCursada::findOrFail($id);
$cursadas->fill(Request::all());
$cursadas > save();
return redirect()->route('asignaturas.cursadas.index');
}
示例5: gzip
function gzip($filename)
{
mkdir_recursive($filename);
$data = file_get_contents($filename);
$gzdata = gzcompress($data, 9);
save($filename, $data);
}
示例6: displayList
function displayList()
{
if ($_SERVER["REQUEST_METHOD"] == "POST") {
//Remove Reminder
if (isset($_POST['action']) && $_POST['action'] == "delete") {
//delete is pressed
echo "Question " . $_POST['action2'] . " has been removed from the test.</br>";
if (isset($this->reminders[$_POST['action2']])) {
unset($this->reminders[$_POST['action2']]);
$this->reminders = array_values($this->reminders);
save();
}
} else {
if (isset($_POST['action5']) && $_POST['action5'] == "add3") {
//edit confirmed
$this->reminders[$_POST['action6']]->edit(get_input($_POST['recipient']), get_input(get_input($_POST['time'])));
save();
}
}
}
for ($i = 0; $i < count($this->reminders); $i++) {
$this->reminders[$i]->display($i);
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['action3']) && $_POST['action3'] == $i) {
echo "<form method='post'>";
echo "<input type='text' name = 'recipient' value='Recipient Email'>";
echo "<input type='text' name = 'time' value='Time to Email'>";
echo "<input type='submit' name = 'submit' value='Confirm Edit'>";
echo "<input type='hidden' name='action5' value='add3'>";
echo "<input type='hidden' name='action6' value='" . $_POST['action4'] . "'>";
echo "</form>";
}
}
}
示例7: test
function test()
{
$result = save("common/upload");
if ($result) {
echo true;
} else {
echo json_encode($result);
}
}
示例8: convert_dir
function convert_dir($directory)
{
$dir = opendir($directory);
while ($file = readdir($dir)) {
if (is_file($directory . "/" . $file)) {
$ext = getftype($file);
if ($file == 'namedb.dat') {
if (file_exists($directory . "/" . $file)) {
$gbs = file($directory . "/" . $file);
$open = fopen($directory . "/" . $file, "w");
$result = 0;
for ($i = 0; $i < sizeof($gbs); $i++) {
$data = unserialize($gbs[$i]);
if (!preg_match('//u', $data['opisanie'])) {
$data['opisanie'] = iconv('cp1251', 'utf-8', $data['opisanie']);
}
fwrite($open, serialize($data) . "\n");
$result++;
}
fclose($open);
}
} elseif ($ext == 'dat') {
$txt = file_get_contents($directory . "/" . $file);
if (!preg_match('//u', $txt)) {
$txt = iconv('cp1251', 'utf8', $txt);
}
save($directory . "/" . $file, $txt, 'w');
$result++;
} elseif ($ext == 'comment') {
if (file_exists($directory . "/" . $file)) {
$gbs = file($directory . "/" . $file);
$open = fopen($directory . "/" . $file, "w");
$result = 0;
for ($i = 0; $i < sizeof($gbs); $i++) {
$data = unserialize($gbs[$i]);
if (!preg_match('//u', $data['content'])) {
$data['content'] = iconv('cp1251', 'utf-8', $data['content']);
}
if (!preg_match('//u', $data['name'])) {
$data['name'] = iconv('cp1251', 'utf-8', $data['name']);
}
fwrite($open, serialize($data) . "\n");
$result++;
}
fclose($open);
}
}
} else {
if (is_dir($directory . "/" . $file) && $file != "." && $file != "..") {
$result += convert_dir($directory . "/" . $file);
}
}
}
closedir($dir);
return $result;
}
示例9: update
public function update(Request $request)
{
//
$this->validate($request, ['name' => 'required|max:255']);
$user_id = $request->input('user_id');
$new_name = $request->input('name');
$user = Users::find($user_id);
$user->name = $new_name;
$user_ > save();
return redirect('user/{id}');
}
示例10: drop
function drop($words)
{
$obj = $this->items[$words];
// Item from inventory to room
if ($obj == 1) {
save(USERFILE, 'inventory', $words, CURRENT_ROOM);
return array('drop', '+' . $words);
}
// Not have item
return array('drop', 'FAIL');
}
示例11: check_visited_and_goto
function check_visited_and_goto($room)
{
// go to new room
save(USERFILE, 'info', 'room', $room);
// check visited (and mark)
if (!load(USERFILE, 'actions', $room . '_visited')) {
save(USERFILE, 'actions', $room . '_visited', "1");
}
// check if end
$ends = new Ends($room);
$ends->check();
return array('goto', 'OK');
}
示例12: processAction
function processAction()
{
$action = assign_input('action', 'R');
$folderID = assign_input('folderID', 'R');
$noteID = assign_input('noteID', 'R');
$parentFolder = assign_input('parentFolder', 'R');
$date = assign_input('date', 'R');
$name = assign_input('name', 'R');
$note = assign_input('note', 'P', 1);
$sortByDate = assign_input('sortByDate', 'R');
switch ($action) {
case 'newFolder':
$res = newFolder($name, $parentFolder);
break;
case 'newNote':
$res = newNote($name, $note, $parentFolder);
break;
case 'toNewFolder':
$res = addToNewFolder($parentFolder, $noteID);
break;
case 'delete':
$res = delete_($noteID ? $noteID : $folderID, $folderID);
break;
case 'rename':
$res = rename_($name, $noteID ? $noteID : $folderID, $folderID);
break;
case 'save':
$res = save($noteID, $note);
break;
case 'get':
$res = getContent($parentFolder, $sortByDate ? 1 : 0);
break;
case 'loadNote':
$res = loadNote($noteID);
break;
case 'search':
break;
default:
$res = array("error" => "no action");
}
/*
if(( isset($res['error']))&&($res['error'])){echo 'Error occured : '.$res['error'].'<br/>';}
if($action=='get'){
echo json_encode($res);
}
*/
echo json_encode($res);
}
示例13: wicketpixie_toplevel_admin
function wicketpixie_toplevel_admin()
{
global $settings;
if ($_POST['action'] == 'save_settings') {
save($_POST, $settings);
}
if ('ccode' == $_REQUEST['action']) {
if ('global_announcement' == $_POST['file']) {
require_once TEMPLATEPATH . '/app/customcode.php';
writeto($_POST['code'], "global_announcement.php");
}
}
add_menu_page('WicketPixie Admin', 'WicketPixie', 'edit_themes', 'wicketpixie-admin.php', 'wicketpixie_admin_index', get_template_directory_uri() . '/images/wicketsmall.png');
}
示例14: dispatch
function dispatch($data, $filePath)
{
$params = getParams();
if (count($params) > 0) {
$response = save($data, $params, $filePath);
} else {
$id = getIdParam();
if ($id) {
$response = detail($data, $id);
} else {
$response = $data;
}
}
return $response;
}
示例15: trivalIndex
/**
* 广度便利树形目录,找到code=>学科中文名字和树形结构
*/
function trivalIndex($url, &$className)
{
$isReadCache = false;
global $cacheDir;
$pattern1 = '/<a.*?onclick="ClickNode\\(\'(.*?)\',.*?>(.*?)<\\/a>/';
//目录的根节点
$pattern2 = '/<input type="checkbox" id="selectbox" value="(.*?)".*?name="(.*?)" .*?>/';
//有子目录的节点
$dir = get_code($url);
$fileName = "./index/{$cacheDir}/" . $dir . ".html";
$content = "";
if (file_exists($fileName)) {
echo "get file {$fileName} from cache\n";
$content = file_get_contents($fileName);
$isReadCache = true;
} else {
echo "get file {$fileName} from network\n";
$content = @file_get_contents($url);
save($fileName, $content);
$isReadCache = false;
}
$match = array();
$ret = preg_match_all($pattern1, $content, $match);
if (!$ret) {
$ret = preg_match_all($pattern2, $content, $match);
echo "[WARNNING] use pattern 2\n {$content}\n";
if (!$ret) {
//echo "not found $url\n";
save("./index/{$cacheDir}/{$cacheDir}.log", $url . "\n" . $content . "\n\n", "a+");
return;
}
}
$code = $match[1];
$name = $match[2];
for ($i = 0; $i < count($code); $i++) {
$namei = $name[$i];
$codei = $code[$i];
//var_dump($codei);
echo "\n{$namei} => {$codei}\n";
addCode($namei, $codei);
$className[$namei] = array();
$url = replace_code($codei);
trivalIndex($url, $className[$namei]);
if ($isReadCache == false) {
sleep(4);
}
}
}