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


PHP Links::save方法代码示例

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


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

示例1: addLinkBy

 public function addLinkBy(Users $byUser, $url)
 {
     $data = array('url' => $url, 'linkable_id' => $this->id, 'linkable_type' => get_class($this), 'site_id' => Sites::findByUrl($url)->id, 'user_id' => $byUser->id);
     $link = new Links();
     $link->save($data);
     return $this;
 }
开发者ID:huoybb,项目名称:movie,代码行数:7,代码来源:linkableTrait.php

示例2: actionCreate

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

示例3: postCreate

 public function postCreate()
 {
     $validator = Validator::make(Input::all(), Links::$rules);
     if ($validator->passes()) {
         $link = new Links();
         $link->message = Input::get('message');
         $link->recipient_id = Input::get('recipient_id');
         $link->sender_id = Auth::user()->id;
         $link->save();
         return Redirect::back()->with('message', 'Your link was sent successfully!');
     } else {
         return Redirect::back()->with('message', 'Sorry! The following errors occured')->withErrors($validator)->withInput();
     }
 }
开发者ID:nicholedwight,项目名称:LinkMe2,代码行数:14,代码来源:LinksController.php

示例4: actionCreate

 /**
  * 创建友情链接
  *
  */
 function actionCreate()
 {
     //创建表单
     $form = Form_Admin_Links::createForm('links', url('links/create'));
     //是否是post提交 及通过验证
     if ($this->_context->isPOST() && $form->validate($_POST)) {
         try {
             //用表单的数据创建模型
             $links = new Links($form->values());
             $links->save();
             return $this->_redirectMessage('创建友情链接成功', '如果你不做出选择系统将自动跳转', url('links/index'), 3);
         } catch (QValidator_ValidateFailedException $ex) {
             $form->invalidate($ex);
         }
     }
     $this->_view['form'] = $form;
     $this->_viewname = 'edit';
 }
开发者ID:BGCX262,项目名称:zxhproject-svn-to-git,代码行数:22,代码来源:links_controller.php

示例5: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Links();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Links'])) {
         $model->attributes = $_POST['Links'];
         $model->id_creator = Yii::app()->user->id;
         if ($model->save()) {
             $linkTranslation = new LinksTranslation();
             $linkTranslation->id_language = 1;
             $linkTranslation->name = $model->name;
             $linkTranslation->link_to = $model->link_to;
             $linkTranslation->id_links = $model->id_links;
             $linkTranslation->save();
             $this->redirect(array('view', 'id' => $model->id_links));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:fipumjdeveloper,项目名称:web,代码行数:24,代码来源:LinksController.php

示例6: doTb

 private function doTb($tid, $cid = 0)
 {
     if ($tid == 2610) {
         //彩票部分
         $cacheId = 'doTb_' . $tid;
         $fcurl = cacheGet($cacheId);
         if (empty($fcurl)) {
             $url = 'http://www.114la.com/icai.json';
             $fcurl = XUtils::fcurl($url);
             cacheSet($cacheId, $fcurl, 3600);
         }
         $fcurl = substr($fcurl, 17, -1);
         $data_arr = json_decode($fcurl, TRUE);
         if (!empty($data_arr)) {
             //对应关系
             $dy = array('ssq' => array(220, 221, 222), 'dlt' => array(223, 224, 225), 'fc3d' => array(226, 227, 228), 'jx_11x5' => array(229, 230, 231));
             foreach ($data_arr as $tp => $v) {
                 $va = $v[0];
                 $fdata[$dy[$tp][0]] = array(0 => array('title' => '上期开奖号码', 'link' => $va['url'][0], 'opt_a' => implode(',', $va['result']), 'opt_b' => $va['phase'], 'opt_c' => $va['date']));
                 $fdata[$dy[$tp][1]] = array(0 => array('title' => '立即投注', 'link' => $va['url'][1]), 1 => array('title' => $va['chain'][0], 'link' => $va['chain'][1]));
                 foreach ($va['link'] as $vl => $tu) {
                     $tu['link'] = $tu['url'];
                     unset($tu['url']);
                     $va['link'][$vl] = $tu;
                 }
                 $fdata[$dy[$tp][2]] = $va['link'];
             }
         }
         if (!empty($fdata)) {
             foreach ($fdata as $cid => $cinfo) {
                 Links::model()->deleteAll("catalog_id=:cid", array(':cid' => $cid));
                 foreach ($cinfo as $info) {
                     try {
                         $model = new Links();
                         $info['catalog_id'] = $cid;
                         $info['title'] = empty($info['title']) ? '待定' : $info['title'];
                         $info['link'] = empty($info['link']) || $info['link'] == '#' ? 'http://www.114la.com/' : $info['link'];
                         $info['mix'] = empty($info['mix']) ? null : base64_decode($info['mix']);
                         $info = array_filter($info);
                         $model->attributes = $this->_form($info);
                         //                        ppr($model->attributes);
                         $model->save();
                     } catch (Exception $exc) {
                         return 'error1caipiao';
                     }
                 }
             }
         }
         return 'ok';
         //            ppr($fdata,1);
     } elseif ($tid == 1114) {
         //实时热点部分
         $cacheId = 'doTb_' . $tid;
         $fcurl = cacheGet($cacheId);
         if (empty($fcurl)) {
             $url = 'http://api4.114la.com/1114_2.json';
             $fcurl = XUtils::fcurl($url);
             cacheSet($cacheId, $fcurl, 3600);
         }
         $fcurl = substr($fcurl, 20, -1);
         //            ppr($fcurl,1);
         if (!empty($fcurl) && ($fcurl = json_decode($fcurl, 1))) {
             //先将对应的旧数据处理
             $old = reqPost('old');
             if (empty($old)) {
                 Links::model()->updateAll(array('status_is' => 'N'), "`catalog_id`='{$cid}'");
             } else {
                 Links::model()->deleteAll("catalog_id=:cid", array(':cid' => $cid));
             }
             //                ppr(Links::model()->findAll("`catalog_id`='$cid'"));
             foreach ($fcurl as $info) {
                 try {
                     $model = new Links();
                     $info['catalog_id'] = $cid;
                     $info['title'] = empty($info['title']) ? '待定' : $info['title'];
                     $info['link'] = empty($info['url']) || $info['url'] == '#' ? 'http://www.114la.com/' : $info['url'];
                     unset($info['url']);
                     $info = array_filter($info);
                     $model->attributes = $this->_form($info);
                     //                        ppr($model->attributes);
                     $model->save();
                 } catch (Exception $exc) {
                     return 'error1';
                 }
             }
             $cacheId = '_catalogAllNum';
             $catalogAllNum = XXcache::refresh($cacheId);
             return empty($catalogAllNum[$cid]) ? 0 : $catalogAllNum[$cid] . ' ok';
         } else {
             return 'error2';
         }
         ppr($data_arr, 1);
     } elseif ($tid > 1000 && $tid < 10000) {
         $tid = (int) $tid;
         $data = $re = 0;
         $cacheId = 'doTb_' . $tid;
         $fcurl = cacheGet($cacheId);
         if (empty($fcurl)) {
             $url = 'http://www.114la.com/api/ky.php?id=' . $tid . '&' . time();
             //                $url = 'http://www.114la.com/api/ky.php?id='.$tid;
//.........这里部分代码省略.........
开发者ID:lp19851119,项目名称:114la,代码行数:101,代码来源:LinksController.php

示例7: createAction

 public function createAction()
 {
     if (!$this->request->isPost()) {
         return $this->dispatcher->forward(array("controller" => "index", "action" => "index"));
     }
     $check = Links::findFirst('longurl="' . $this->request->getPost("longurl") . '"');
     if ($check) {
         $this->flash->success("links was already created");
         $this->view->token = $check->token;
         return $this->dispatcher->forward(array("controller" => "index", "action" => "index"));
     } else {
         $hash = md5($this->request->getPost("longurl") . microtime());
         $token = substr($hash, -7);
         $links = new Links();
         $links->token = $token;
         $links->longurl = trim($this->request->getPost("longurl"));
         $links->visitor_count = 0;
         if (!$links->save()) {
             foreach ($links->getMessages() as $message) {
                 echo $message . "<br />";
                 $this->flash->error((string) $message);
             }
             die;
             return $this->dispatcher->forward(array("controller" => "index", "action" => "index"));
         } else {
             $this->flash->success("links was created successfully");
             $this->view->token = $token;
             return $this->dispatcher->forward(array("controller" => "index", "action" => "index"));
         }
     }
 }
开发者ID:spiritwild,项目名称:Url-Shortener,代码行数:31,代码来源:LinksController.php

示例8: actionSave_link

 public function actionSave_link()
 {
     if (isset($_POST['cancel'])) {
         $this->redirect($this->createAbsoluteUrl('default/list_links', $_GET));
     }
     if (isset($_POST['delete'])) {
         $this->actionDelete_link();
         $this->redirect($this->createAbsoluteUrl('default/list_links', $_GET));
     }
     if (isset($_GET['link_id'])) {
         $model = Links::model()->findByPk($_GET['link_id']);
     } else {
         $model = new Links();
     }
     if (isset($_POST['Links'])) {
         $model->attributes = $_POST['Links'];
         if ($model->validate()) {
             $model->save();
             $this->redirect($this->createAbsoluteUrl('default/list_links', $_GET));
         }
     }
     $this->render('links/save_link', array('model' => $model));
 }
开发者ID:vitalya-xxx,项目名称:vitacod.ru,代码行数:23,代码来源:DefaultController.php


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