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


PHP p函数代码示例

本文整理汇总了PHP中p函数的典型用法代码示例。如果您正苦于以下问题:PHP p函数的具体用法?PHP p怎么用?PHP p使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: laravel

 public function laravel()
 {
     /*
      * 查询所有的记录
      * */
     $list = \App\Models\Article::all()->toArray();
     p($list);
     /*
     * 查询一条记录并转化为数组
     		$list = \App\Models\Article::first()->toArray();
     		p($list);
     */
     /*
     * 查询指定记录
     * 
     		$list = \App\Models\Article::find(1)->toArray();
     		p($list);
     */
     /*
      * 删除指定记录
     $status = \App\Models\Article::where('id', '=', 11)->delete();;
     p($status);
     */
     // 更多请自己查看Eloquent ORM 开发手册
 }
开发者ID:phpdn,项目名称:skphp,代码行数:25,代码来源:DbController.php

示例2: update_password

 public function update_password()
 {
     $this->load->model('www/user_model', $user);
     $oldpass = $_POST['User.LoginPassword'];
     $newpass = $_POST['User.NewPassword'];
     p($newpass);
     $rnewpass = $_POST['User.RepeatPassword'];
     p($rnewpass);
     $LoginName = $this->session->userdata('login_name');
     $user_id = $this->session->userdata('user_id');
     $OrgID = $this->session->userdata('org_id');
     $user_data = $this->user->LoginUserData2($LoginName, $OrgID);
     if ($this->user->checkPassword($oldpass, $user_data['LOGIN_PASSWORD']) == true) {
         if ($newpass == $rnewpass) {
             //$this->user->update_password($OrgID, $user_id, $login_password);
             $res['res'] = 'suc';
             $res['msg'] = ' 密码修改成功!';
         } else {
             $res['res'] = 'fail';
             $res['msg'] = '重复密码不一致!';
         }
     } else {
         $res['res'] = 'fail';
         $res['msg'] = '原密码错误!';
     }
     echo json_encode($res);
 }
开发者ID:aslijiasheng,项目名称:jasongo,代码行数:27,代码来源:user.php

示例3: test

 public function test()
 {
     $url = __ROOT__ . '/getWxInfo.php';
     $arr = https_request($url);
     p($arr);
     die;
 }
开发者ID:PaulSunbinovic,项目名称:evcpc,代码行数:7,代码来源:TestAction.class.php

示例4: about_action

 public static function about_action()
 {
     // 拦截
     self::role('member');
     $setting = setting_model::get_by_id(setting_model::id_about);
     if (visitor::is_post()) {
         // 拦截
         self::csrf('member');
         try {
             // 校验
             $checker = new lazy_checker(p());
             $checker->check('content', array('change_to' => 'string', 'cannot_be' => array('', '关于不能为空')));
             // 执行
             $setting->value = $checker->content;
             $setting->save();
             // 成功
             self::json_result(true, '关于信息编辑成功。', 0, url('site/about'));
         } catch (check_failed $e) {
             // 失败
             self::json_result(false, $e->get_reasons());
         }
     } else {
         // 呈现
         self::set('content', $setting->value);
         self::show_page();
     }
 }
开发者ID:xpd1437,项目名称:swap,代码行数:27,代码来源:setting_controller.php

示例5: actionSay

 public function actionSay()
 {
     $url = 'http://yii.com/users';
     $curl = new Curl();
     $rs = $curl->get($url);
     p($rs);
     p($curl);
     exit;
     //        exit;
     //        $curl->head( 'http://yii.com/users' );
     /*$curl->setOption(
                 CURLOPT_POSTFIELDS,
                 http_build_query(array(
     
                     )
                 ));
             $rs = $curl->post($url);
     
             p($rs);
     
     
             $options = $curl->setOption(CURLOPT_POSTFIELDS, 'category_name')->get($url);
     
     
             p($options);*/
 }
开发者ID:xiaohongyang,项目名称:yii_shop,代码行数:26,代码来源:TestsayController.php

示例6: loginCheck

 public function loginCheck()
 {
     if (!IS_POST) {
         halt('页面不存在!');
     }
     $username = I('username');
     $password = I('password', '', 'md5');
     if (empty($username)) {
         $this->error('请输入用户名!');
         exit;
     }
     if (empty($password)) {
         $this->error('请输入密码!');
         exit;
     }
     $user = M('user')->where(array('username' => $username))->find();
     p($user);
     if (!$user || $user['username'] != $username || $user['password'] != $password) {
         $this->error('用户名或密码错误!');
     }
     if ($_SESSION['verify'] != md5($_POST['verify'])) {
         $this->error("验证码错误!");
     }
     $data = array('uid' => $user['uid'], 'time' => time(), 'loginip' => get_client_ip());
     M('user')->save($data);
     session('uid', $user['uid']);
     session('username', $user['username']);
     session('logintime', date('Y-m-d H:i:s', $user['time']));
     session('loginip', $user['loginip']);
     redirect(__GROUP__);
 }
开发者ID:hanxiansen,项目名称:blog,代码行数:31,代码来源:LoginAction.class.php

示例7: registerAction

 function registerAction()
 {
     $model = Zed::model('user');
     $name = z::post('name');
     $login = z::post('login');
     $pass = z::post('pass');
     $pass2 = z::post('pass2');
     $age = z::post('age');
     $email = z::post('email');
     $gender = z::post('gender');
     $userKey = $model->hash_data(mt_rand(100000, 999999) . time());
     $id = $model->checkMatch($login);
     if ($id) {
         print "this login already exist ";
         print "<a href='http://test4.com:81/course_work/auth/register'>back to registration</a>";
         exit;
     }
     if ($pass2 == '') {
         p(header("location:http://test4.com:81/course_work/auth/register?error=empty_pass2"));
         exit;
     }
     if (preg_match("/^[a-z0-9_-]{3 , 16}\$/", $login) || strlen($pass) > 6 && $pass == $pass2) {
         $data = ['name' => $name, 'login' => $login, 'pass' => $pass, 'age' => $age, 'email' => $email, 'gender' => $gender, 'userKey' => $userKey];
         //pr($data);
         $new_user_id = $model->create($data);
         $_SESSION['id'] = $new_user_id;
         setcookie('user_key', $userKey, time() + 3600 * 24 * 30);
         //p("user with name:{$name} and login {$login} created");
         header("location:http://test4.com:81/course_work/article/selectArticle");
     } else {
         p(header("location:http://test4.com:81/course_work/auth/register?error=novalid_login_or_pass"));
         exit;
     }
 }
开发者ID:RoykoSerhiy,项目名称:php_projects,代码行数:34,代码来源:Auth.php

示例8: index

		public function index(){
			$user=M('Admin');
			p($user);
		   $data=$user->find($id);
            $this->user=$data;	
		    $this->display('Index/password');
		   }
开发者ID:joker2580136,项目名称:KyoMiniBlog,代码行数:7,代码来源:UserAction.class.php

示例9: insertOrUpdate

 public function insertOrUpdate($url, $lastMod, $parentId = 0)
 {
     /* @var $stmt PDOStatement */
     p("url {$url}");
     $stmt = null;
     $sql = "SELECT id, lastMod FROM html WHERE url = :url";
     $params = array(':url' => $url);
     /** @var $result PDOStatement */
     if ($result = $this->select($sql, $params)) {
         if ($row = $result->fetch(PDO::FETCH_OBJ)) {
             if ($row->lastMod == $lastMod) {
                 return true;
             }
             $content = $this->getRemoteContent($url);
             $sql = "UPDATE `html` SET `content` = :content, `lastMod` = :lastMod WHERE `id` = :id";
             $params = array(':content' => $content, ':lastMod' => $lastMod, ':id' => $row->id);
             $this->sql($sql, $params);
         } else {
             $content = $this->getRemoteContent($url);
             $sql = "INSERT INTO `html` (`parentId`, `url`, `lastMod`, `content`) VALUES ( :parentId, :url, :lastMod, :content )";
             $params = array(':parentId' => $parentId, ':url' => $url, ':lastMod' => $lastMod, ':content' => $content);
             $this->sql($sql, $params);
         }
     }
     return true;
 }
开发者ID:rocket1,项目名称:master,代码行数:26,代码来源:SSpy_Model.php

示例10: run

 public function run($args)
 {
     //        echo date('Y-m-d', strtotime('Aug 9 2008')); die;
     $mongo = new Mongo();
     $collection = $mongo->mma->events;
     $cursor = $collection->find()->sort(['date_import' => 1]);
     foreach ($cursor as $item) {
         if (!isset($item['name'])) {
             continue;
         }
         $item['date_import'] = time();
         $collection->update(array('_id' => $item['_id']), $item);
         $name = trim(trim($item['name']));
         $date = str_replace('/ ', '', $item['date']);
         $date = date('Y-m-d', strtotime($date));
         $mma_event = MMAEvent::model()->findByAttributes(['name' => $name]);
         if (!$mma_event) {
             $mma_event = new MMAEvent();
             $mma_event->name = $name;
             $mma_event->sherdog_id = $item['id'];
             $mma_event->date = $date;
             $mma_event->save();
             if ($mma_event->errors) {
                 p($mma_event->errors);
                 $this->log("Не могу сохранить MMAEvent: " . $mma_event->errors_str, CLogger::LEVEL_ERROR);
             }
         }
     }
 }
开发者ID:blindest,项目名称:Yii-CMS-2.0,代码行数:29,代码来源:ImportEventsFromMongoCommand.php

示例11: test

 public function test($event)
 {
     echo '<hr/>';
     echo $this->className();
     echo '<hr/>';
     p($event->data);
 }
开发者ID:xiaohongyang,项目名称:yii_shop,代码行数:7,代码来源:PublicController.php

示例12: do_register_action

 public static function do_register_action()
 {
     self::method('post');
     try {
         $checker = new lazy_checker(p());
         $checker->check('name', array('change_to' => 'string', 'cannot_be' => array('', '用户名不能为空'), 'char_size' => array(3, user_model::name_len, '用户名的长度为%d-%d个字符'), 'callback' => function ($name) {
             if (user_model::get_one(array('name' => $name)) !== null) {
                 return '该用户已被注册';
             }
         }));
         $checker->check('pass', array('change_to' => 'string', 'cannot_be' => array('', '密码不能为空'), 'char_size' => array(6, -1, '密码长度必须大于等于%d个字符')));
         if (p_str('re_pass') !== $checker->pass) {
             $checker->failed('pass', '两次输入的密码不一致');
         }
         $salt = random_sha1();
         $pass = user_model::get_crypted_pass($checker->pass, $salt);
         $user = array('name' => $checker->name, 'pass' => $pass, 'salt' => $salt, 'register_time' => clock::get_stamp());
         $user_id = user_model::add($user);
         visitor::set_role('user', $user_id, 0, array('name' => $user['name']));
         online_service::refresh_online_count();
         self::json_result(true, '', 0, url('site/index'));
     } catch (check_failed $e) {
         self::json_result(false, $e->get_reasons());
     }
 }
开发者ID:xpd1437,项目名称:swap,代码行数:25,代码来源:user_controller.php

示例13: new_action

 public static function new_action()
 {
     // 拦截
     self::method('post');
     $post_id = g_int('post_id');
     $post = post_model::get_by_id($post_id);
     self::forward_404_if($post === null, '文章不存在,无法评论');
     try {
         // 校验
         $checker = new lazy_checker(p());
         $checker->check('captcha', array('should_be' => array(setting_model::get_by_id(setting_model::id_captcha_answer)->value, '验证码不正确')));
         $checker->del('captcha');
         $checker->check_model_rules('comment');
         $comment = $checker->get_all();
         if (!visitor::has_role('member') && member_model::get_one(array('name' => $comment['author'])) !== null) {
             $checker->failed('author', '您不能使用管理员的昵称');
         }
         // 执行
         $comment['post_id'] = $post_id;
         $comment['pub_time'] = clock::get_stamp();
         comment_model::add($comment);
         post_model::inc_by_id(array('comment_count' => 1), $post_id);
         setting_model::inc_by_id(array('value' => 1), setting_model::id_comment_count);
         // 成功
         self::json_result(true, '评论成功', 0, url('post/show?id=' . $post_id));
     } catch (check_failed $e) {
         // 失败
         self::json_result(false, $e->get_reasons());
     }
 }
开发者ID:xpd1437,项目名称:swap,代码行数:30,代码来源:comment_controller.php

示例14: edit_action

 public static function edit_action()
 {
     // 拦截
     self::role('member');
     $category = category_model::get_by_id(g_int('id'));
     self::forward_404_if($category === null, '分类不存在');
     if (visitor::is_post()) {
         // 拦截
         self::csrf('member');
         try {
             // 校验
             $checker = new lazy_checker(p());
             $checker->check_model_rules('category');
             // 执行
             $category->name = $checker->name;
             $category->save();
             // 成功
             self::json_result(true, '分类编辑成功。', 0, url('category/index'));
         } catch (check_failed $e) {
             // 失败
             self::json_result(false, $e->get_reasons());
         }
     } else {
         // 呈现
         self::set('category', $category);
         self::show_page();
     }
 }
开发者ID:xpd1437,项目名称:swap,代码行数:28,代码来源:category_controller.php

示例15: saveInfoTwo

 public function saveInfoTwo()
 {
     // 最新的百度编辑器的功能->只需要配置对应的path即可 配置文件设置非常的棒  降低学习成本
     $data = $this->input->post('content');
     p($data);
     die;
 }
开发者ID:ZuoYouLai,项目名称:studyCI,代码行数:7,代码来源:BaiduEditer.php


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