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


PHP Options::find方法代碼示例

本文整理匯總了PHP中Options::find方法的典型用法代碼示例。如果您正苦於以下問題:PHP Options::find方法的具體用法?PHP Options::find怎麽用?PHP Options::find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Options的用法示例。


在下文中一共展示了Options::find方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: disableOption

 public function disableOption($option_id)
 {
     $option = Options::find($option_id);
     $option->active = 0;
     $option->save();
     return Redirect::back();
 }
開發者ID:sidis405,項目名稱:s-opa,代碼行數:7,代碼來源:AdminQuestionsController.php

示例2: showAction

 public function showAction($question_id)
 {
     $this->view->poll = Questions::findFirst($question_id);
     //$this->view->options = Options::findByQuestionId($question_id);
     $this->view->options = Options::find(array('question_id = ?0', 'bind' => array($question_id), 'order' => 'vote DESC'));
 }
開發者ID:hymns,項目名稱:PhalconTutorial,代碼行數:6,代碼來源:PollController.php

示例3: rows

<?php

/**
 * Models Plugin Example
 * Add this to a view in your template
 */
// Require the model file
require MODELS_PATH . 'Options.php';
// Find Example with cache (returns array of objects)
$all_opts = Options::find()->cache('cacheIdentifier')->all();
// Find Example with select
$three_opts = Options::find()->limit(3)->select(['option_id', 'option_name'])->orderBy('option_id DESC')->all();
// FindByPk Example (returns Object)
$opt1 = Options::findByPk(1);
// Print out the record with Pk = 1
echo '<h2>Row found by Primary Key</h2>';
echo "Primary Key 1: " . $opt1->option_name . " => " . $opt1->option_value . "<br>";
// Print out the three first rows in Options
echo '<h2>Three last rows with select</h2>';
foreach ($three_opts as $opt) {
    echo $opt->option_name . '<br>';
}
// Print all rows in Options (cached)
echo '<h2>All rows (Cached)</h2>';
foreach ($all_opts as $opt) {
    echo $opt->option_name . '<br>';
}
開發者ID:jellingsen,項目名稱:db-models,代碼行數:27,代碼來源:example.php


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