当前位置: 首页>>代码示例>>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;未经允许,请勿转载。