本文整理汇总了PHP中Thread::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Thread::all方法的具体用法?PHP Thread::all怎么用?PHP Thread::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Thread
的用法示例。
在下文中一共展示了Thread::all方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: error_reporting
?>
" >
<button class="wmd-submit" type="submit" ><i class='fa fa-search fa-fw'></i></button>
</form>
<?php
//ini_set("display_errors",1);
error_reporting(1);
if (!empty($_GET["search"])) {
$words = $_GET["search"];
//メタ文字のescape化
$words2 = preg_replace_callback("/[\\*\\?\\+\\[\\]\\(\\)\\{\\}\\^\$\\|\\\\.\\/]/", function ($matches) {
return "\\" . $matches[0];
}, $words);
$threads = Thread::all();
$result_list = array();
//全スレッド
for ($j = 0; $j < count($threads); $j++) {
$Post = $threads[$j]->getAllPosts();
//全ポスト
for ($i = 0; $i < count($Post); $i++) {
//本文の抜出し
$html = str_get_html($Post[$i]->getContent());
//本文match?
if (preg_match("/{$words2}/i", $html->plaintext)) {
$obj = array("thread_id" => $threads[$j]->getId(), "post_id" => $Post[$i]->getPostId(), "title" => $threads[$j]->getTitle(), "body" => $html->plaintext);
array_push($result_list, $obj);
}
}
}
示例2: foreach
<table >
<thead>
<tr>
<td>id</td>
<td>タイトル</td>
<td>スレのホスト</td>
<td>Guest</td>
<td>野田</td>
<td>葛飾</td>
<td>削除</td>
</tr>
</thead>
<tbody>
<?php
foreach (Thread::all() as $thread) {
?>
<tr>
<td><?php
echo $thread->getId();
?>
</td>
<td> <?php
echo $thread->getTitle();
?>
</td>
<td> <?php
echo $thread->getHost()->getNickname();
?>
</td>
<?php
示例3: home
public function home()
{
$threads = Thread::all();
require_once ROOT . DS . 'application' . DS . 'view' . DS . 'home.php';
}
示例4: threadList
public static function threadList()
{
$threads = Thread::all();
View::make('thread/thread_list.html', array('threads' => $threads));
}