当前位置: 首页>>代码示例>>PHP>>正文


PHP People::save方法代码示例

本文整理汇总了PHP中People::save方法的典型用法代码示例。如果您正苦于以下问题:PHP People::save方法的具体用法?PHP People::save怎么用?PHP People::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在People的用法示例。


在下文中一共展示了People::save方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new People();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['People'])) {
         $model->attributes = $_POST['People'];
         if ($model->save()) {
             $model->mid = $model->get_mid();
             $model->save();
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $ac = People::getAutoCompleteFields();
     $this->render('create', array('model' => $model, 'ac' => $ac));
 }
开发者ID:srinidg,项目名称:stbennos-parish,代码行数:20,代码来源:PersonController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //
     $name = $request->input("name");
     $age = $request->input("age");
     $people = new People();
     $people->name = $name;
     $people->age = $age;
     $people->save();
     return "name={{$name}}, age={{$age}}";
 }
开发者ID:neetp7k9,项目名称:laravel_practice,代码行数:17,代码来源:Main.php

示例3: actionCreate

 /**
  * 把一个用户任命为人员页面和处理方法
  * @param integer $uid 用户ID
  */
 public function actionCreate()
 {
     $model = new People();
     $model->categorys = Category::model()->findAll(array('condition' => 'type="teacher"', 'order' => 'weight ASC'));
     if (isset($_POST['People'])) {
         $model->checkUser();
         $model->attributes = $_POST['People'];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', '操作成功');
             $this->redirect(array('uploadFace', 'id' => $model->id));
         } else {
             Yii::app()->user->setFlash('error', '操作失败');
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:20,代码来源:PeopleController.php

示例4: registerAction

 public function registerAction()
 {
     echo "RegStart";
     $user = new People();
     //Store and check for errors
     $success = $user->save($this->request->getPost(), array('name', 'email'));
     if ($success) {
         echo "Thanks for registering!";
     } else {
         echo "Sorry, the following problems were generated: ";
         foreach ($user->getMessages() as $message) {
             echo $message->getMessage(), "<br/>";
         }
     }
     $this->view->disable();
 }
开发者ID:Isachenko,项目名称:phalcon_tutorial,代码行数:16,代码来源:SignupController.php

示例5: actionTogglePeople

 /**
  * 设置、取消用户的实验室成员身份
  * @param unknown $id
  */
 public function actionTogglePeople($id)
 {
     $user = $this->loadModel($id);
     $people = $user->people;
     if ($people) {
         if ($people->delete()) {
             Yii::app()->user->setFlash('success', '已将用户移除实验室成员!');
         }
     } else {
         $people = new People();
         $people->name = $user->name;
         $people->userId = $user->id;
         $people->email = $user->email;
         if ($people->save()) {
             Yii::app()->user->setFlash('success', '已将用户设为实验室成员!');
         }
     }
     $this->redirect(array('admin'));
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:23,代码来源:UserController.php

示例6: actionDependents

 public function actionDependents($id)
 {
     $model = $this->loadModel($id);
     if (isset($_POST['People']['dependent'])) {
         for ($i = 0; $i < 10; ++$i) {
             if (isset($_POST['People']['dependent'][$i])) {
                 if ($pid = $_POST['People']['dependent'][$i]['id']) {
                     $p = People::model()->findByPk($pid);
                 } else {
                     $p = new People();
                 }
                 $p->attributes = $_POST['People']['dependent'][$i];
                 $p->family_id = $model->id;
                 $p->role = 'dependent';
                 $p->save();
             }
         }
     }
     $ppl_ac = People::getAutoCompleteFields();
     $this->render('dependents', array('model' => $model, 'ppl_ac' => $ppl_ac));
 }
开发者ID:srinidg,项目名称:stbennos-parish,代码行数:21,代码来源:FamilyController.php

示例7: array

<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/People.php";
session_start();
if (empty($_SESSION['address_book'])) {
    $_SESSION['address_book'] = array();
}
$app = new Silex\Application();
$app['debug'] = true;
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
$app->get("/", function () use($app) {
    return $app['twig']->render('address_book.html.twig', array('people' => People::getAll()));
});
$app->post("/people", function () use($app) {
    $person = new People($_POST['name'], $_POST['phone_number'], $_POST['address']);
    $person->save();
    return $app['twig']->render('add_contact.html.twig', array('newperson' => $person));
});
$app->post("/delete_all", function () use($app) {
    People::deleteAll();
    return $app['twig']->render('delete_all.html.twig');
});
return $app;
开发者ID:JordanNavratil,项目名称:Address_book,代码行数:24,代码来源:app.php


注:本文中的People::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。