當前位置: 首頁>>代碼示例>>PHP>>正文


PHP save函數代碼示例

本文整理匯總了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();
     }
 }
開發者ID:amrutjadhav,項目名稱:Laravel_application,代碼行數:27,代碼來源:AdminController.php

示例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);
}
開發者ID:Razinsky,項目名稱:echaude-com,代碼行數:27,代碼來源:utils.save_menus.php

示例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;
 }
開發者ID:BGCX067,項目名稱:facebook-jewishdates-svn-to-git,代碼行數:7,代碼來源:pollRecord.php

示例4: update

 public function update(EditAsignaturasCursadasRequest $request, $id)
 {
     $cursadas = AsignaturaCursada::findOrFail($id);
     $cursadas->fill(Request::all());
     $cursadas > save();
     return redirect()->route('asignaturas.cursadas.index');
 }
開發者ID:jaime1992,項目名稱:Proyecto-Sala-Utem,代碼行數:7,代碼來源:AsignaturasCursadasController.php

示例5: gzip

function gzip($filename)
{
    mkdir_recursive($filename);
    $data = file_get_contents($filename);
    $gzdata = gzcompress($data, 9);
    save($filename, $data);
}
開發者ID:baki250,項目名稱:angular-io-app,代碼行數:7,代碼來源:lib.global.php

示例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>";
         }
     }
 }
開發者ID:ForestTurtle,項目名稱:FYINC,代碼行數:33,代碼來源:util.php

示例7: test

 function test()
 {
     $result = save("common/upload");
     if ($result) {
         echo true;
     } else {
         echo json_encode($result);
     }
 }
開發者ID:XiaoFeiFeng,項目名稱:demo,代碼行數:9,代碼來源:upload.php

示例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;
}
開發者ID:porese,項目名稱:kandidat-cms,代碼行數:56,代碼來源:convert.php

示例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}');
 }
開發者ID:avminon,項目名稱:local_dev,代碼行數:11,代碼來源:LessonController.php

示例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');
 }
開發者ID:jdiperla,項目名稱:text-adventure-engine,代碼行數:11,代碼來源:Inventory.php

示例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');
 }
開發者ID:jdiperla,項目名稱:text-adventure-engine,代碼行數:13,代碼來源:Exits.php

示例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);
}
開發者ID:louisinhongkong,項目名稱:NoteTree,代碼行數:50,代碼來源:api.php

示例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');
}
開發者ID:jojospaghettio,項目名稱:wicketpixie,代碼行數:14,代碼來源:wicketpixie-admin.php

示例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;
}
開發者ID:aique,項目名稱:angular-staying-sharp,代碼行數:15,代碼來源:dispatcher.php

示例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);
        }
    }
}
開發者ID:highestgoodlikewater,項目名稱:cnkispider,代碼行數:51,代碼來源:index.php


注:本文中的save函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。