function view($mod, $json) { switch ($mod) { case "nav": if (!$json) { echo ' <li> <a href="#" class="nav-badge" data-toggle="modal" data-target="#myModal"> 註冊 </a> </li> <li> <a href="#signin" class="nav-badge" data-toggle="modal" data-target="#myModal"> 登入 </a> </li> <li class="navbar-new"><a href="#">發起活動</a></li> '; } else { $cart = json_decode($json); echo ' <li> <img src="' . $cart[0]->ImgSrc . '" id="usericon" class="img-responsive nav-usericon"> </li> <li class="dropdown"> <a href="#" id="userpage" class="dropdown-toggle " data-toggle="dropdown" role="button" aria-expanded="false" style="padding-left:6px;"> ' . $cart[0]->Name . '<span class="caret"></span> </a> <ul class="dropdown-menu" role="menu"> <li><a href="#">我的旅程</a></li> <li><a href="#">我的活動</a></li> <li><a href="#">個人資料</a></li> <li><a href="#">評價</a></li> <li class="divider"></li> <li><a href="#" onclick="userlogout();">登出</a></li> </ul> </li> <li> <a href="#" class="nav-badge"> 訊息<span class="badge" id="badge">' . $cart[0]->unread . '<span> </a> </li> <li class="navbar-new"><a href="#">發起活動</a></li> '; } break; case "serch": $cart = json_decode($json); for ($i = 0; $i < count($cart); $i++) { $place = explode(',', $cart[$i]->place); echo ' <div class="panel panel-default products-panel"> <div class="panel-body products-body"> <div class="row products-row"> <div class="col-lg-4 col-sm-12 products-img"> <img src="' . $cart[$i]->TripImg . '" class="img-responsive"> <div class="products-price"> <small>$</small>' . $cart[$i]->price . ' </div> </div> <div class="col-lg-8 col-sm-12 products-content"> <div class="products-title"> ' . $cart[$i]->Title . ' </div> <div class="hidden-xs"> <div class="products-map"> <span class="glyphicon glyphicon-map-marker" aria-hidden="true"> 從 <a rel="#">' . $place[0] . '</a> 出發 , 到 '; $countStep = count_objects($cart[$i]->place); for ($j = 1; $j < $countStep; $j++) { if ($j != $countStep - 1) { echo ' <a rel="#">' . $place[$j] . '</a> <span class="glyphicon glyphicon-arrow-right" aria-hidden="true"></span>'; } else { echo ' <a rel="#">' . $place[$j] . '</a>'; } } echo '</span> </div> <div class="products-date"> <span class="glyphicon glyphicon-calendar" aria-hidden="true"> 出發日期: ' . $cart[$i]->StartDay . ',共' . $cart[$i]->DiffDate . '天 </span> </div> <div class="products-text"> ' . $cart[$i]->Content . '</div> </div> <hr class="hr0"> <div class="row"> <div class="col-lg-5 col-md-5 col-sm-6"> <div class="media"> <div class="media-left"> <a href="#"> <img class="media-object products-usericon img-circle" src="' . $cart[$i]->UserImg . '"> </a> </div> <div class="media-body"> <h4 class="products-user media-heading">' . $cart[$i]->Name . '</h4> <p class="products-media-text">評價 ' . $cart[$i]->rank . ' ‧ 感興趣 ' . $cart[$i]->Watch . ' ‧ 參加 ' . $cart[$i]->Join . ' </p> </div> </div> </div> <div class="col-lg-7 col-md-7 col-sm-6"> <button class="btn btn-default btn-lg btn-block products-btn" type="submit" onclick="location.href=`events.php?aid=' . $cart[$i]->ActivityId . '`">查看詳情</button> </div> </div> </div> </div> </div> </div>'; } break; case "activity": $cart = json_decode($json); $place = explode(',', $cart[0]->place); echo ' <div class="summary-title-img" style="background-image: url(' . $cart[0]->TripImg . ');"></div> <div class="panel panel-default summary-a"> <div class="panel-body"> <div class="container"> <div class="row"> <div class="col-lg-3"> <div class="well summary-well"> <div class="summary-usericon text-center"> <img src="' . $cart[0]->UserImg . '" class="img-circle" alt="..."></div> <div class="summary-username text-center">' . $cart[0]->Name . '</div> <div class="summary-star text-center"> <div class="rating"><span>☆</span><span>☆</span><span>☆</span><span>☆</span><span>☆</span> </div> </div> <button class="btn btn-default text-center btn-block" type="button">關於發起人</button> </div> </div> <div class="col-lg-9"> <div class="row"> <div class="col-lg-12"> <div class="summary-title">' . $cart[0]->Title . ' <span class="label label-warning">招募中</span></div> <hr> </div> <div class="col-lg-12"> <div class="summary-map"> <span class="glyphicon glyphicon-map-marker" aria-hidden="true" style="line-height: 1.5;"> 從 <a rel="#">' . $place[0] . '</a> 出發 , 到 '; $countStep = count_objects($cart[0]->place); for ($j = 1; $j < $countStep; $j++) { if ($j != $countStep - 1) { echo ' <a rel="#">' . $place[$j] . '</a> <span class="glyphicon glyphicon-arrow-right" aria-hidden="true"></span>'; } else { echo ' <a rel="#">' . $place[$j] . '</a>'; } } echo ' </span> </div> </div> <div class="col-lg-5"> <div class="summary-date"><span class="glyphicon glyphicon-calendar" aria-hidden="true"> 出發日期: ' . $cart[0]->StartDay . ',共' . $cart[0]->DiffDate . '天</span></div> </div> <div class="col-lg-6"> <div class="summary-date"><span class="glyphicon glyphicon-calendar" aria-hidden="true"> 截止日期: ' . $cart[0]->ApplyStop . '</span></div> </div> <div class="col-lg-5"> <div class="summary-icon"><span class="glyphicon glyphicon-usd" aria-hidden="true"> 預估費用: ' . $cart[0]->price . '元</span></div> </div> <div class="col-lg-6"> <div class="summary-icon"><span class="glyphicon glyphicon-road" aria-hidden="true"> 交通方式: 開車</span></div> </div> <div class="col-lg-12"> <hr> </div> <div class="col-lg-5"> <div class="summary-icon"><span class="glyphicon glyphicon-user" aria-hidden="true"> 參加人數: ' . $cart[0]->Join . '人</span></div> <div class="summary-m-usericon"> </div> </div> <div class="col-lg-5"> <div class="summary-icon"><span class="glyphicon glyphicon-heart-empty" aria-hidden="true"> 關注人數: ' . $cart[0]->Watch . '人</span></div> <div class="summary-m-usericon"> </div> </div> </div> </div> </div> </div> </div> </div> '; break; case "activity-plan": $cart = json_decode($json); echo ' <div class="container" id="description"> <div class="row"> <div class="col-lg-9" id="ww"> <div class="description-title">結伴詳情</div> <div class="col-lg-12 "> <div class="row"> '; for ($i = 0; $i < count($cart); $i++) { echo ' <div class="col-lg-2"> <div class="description-li-title"> ' . $cart[$i]->Title . ' </div> </div> <div class="col-lg-10"> <div class="col-lg-4 rm-padding"> <div class="description-img" style="background-image:url(' . $cart[$i]->ImgSrc . ')"></div> </div> <div class="col-lg-12 "> <div class="description-li-text"> ' . $cart[$i]->Content . ' </div> <hr> </div> </div> '; } echo ' </div> </div> <div class="col-lg-12"> <hr> </div> </div> <div class="col-lg-3" id="bookit"> <div clss="bookit-panel"> <div class="panel panel-default"> <div class="bookit-heading panel-heading" style="background: #5c5a56;"> <div class="row"> <div class="col-lg-8"> <div class="bookit-price">$<strong>5,634</strong>元</div> </div> <div class="col-lg-4"> <div class="bookit-price text-right"><small>每人</small></div> </div> </div> </div> <div class="panel-body "> <div class="col-lg-8 bookit-col"> <div class="bookit-input"> <label for="">聯絡電話</label> <input type="text" class="form-control" id="" placeholder="手機號碼"> </div> </div> <div class="col-lg-4 bookit-col"> <div class="bookit-input"> <label>人數</label> <select class="form-control"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> </select> </div> </div> <button class="btn btn-default btn-lg btn-block" type="button">馬上參加</button> </div> <div class="panel-footer"> <button class="btn btn-default btn-lg btn-block" type="button"><span class="glyphicon glyphicon-heart-empty" aria-hidden="true"></span> 關注活動</button> </div> </div> </div> </div> </div> </div> '; break; case "activity-review": $cart = json_decode($json); echo ' <div class="container" id="review"> <div class="row description-ttitle"> <div class="col-lg-12 col-md-12 col-sm-12"> <div class="description-title">問與答</div> </div> </div> '; for ($i = 0; $i < count($cart); $i++) { echo ' <div class="row review"> <div class="col-lg-1 col-md-12 col-sm-12 text-center"> <img src="' . $cart[$i]->Imgsrc . '" class="img-circle review-user" alt="..." style=""> <div class="caption">' . $cart[$i]->Name . '</div> </div> <div class="col-lg-10 col-md-12 col-sm-12"> <div class="review-text"> ' . $cart[$i]->Question . '</div> <div class="review-date text-right">' . $cart[$i]->CreateDate . '</div> '; if (!is_null($cart[$i]->Answer)) { echo ' <hr class="hr0"> <div class="review-title">Alex321 , 回應了這篇評論 </div> <div class="review-text"> 我們和朋友一起去度假,發現這個酒店及其完美。它很接近擁擠喧囂我所有的朋友。 </div> <div class="review-date text-right">2012年11月6日</div> '; } echo ' </div> </div> <hr class="hr3"> '; } echo ' <div class="row review-question well"> <div class="col-lg-1 col-md-12 col-sm-12 text-center"> <img src="image/1382551223.jpg" class="img-circle review-user" alt="..." style=""> <div class="caption">Alex12345</div> </div> <div class="col-lg-10 col-md-12 col-sm-12"> <div class="review-textarea"> <textarea class="form-control" rows="4" placeholder="你好 , Alex , 你想問什麼問題?"></textarea> </div> </div> <div class="col-lg-1 col-md-12 col-sm-12 text-center"> <button class="btn btn-default btn-success review-sent" type="submit">馬上提問</button> </div> </div> </div> '; break; } }
<div class="panel panel-default products-panel"> <div class="panel-body products-body"> <div class="row products-row"> <div class="col-lg-4 col-sm-12 products-img"> <img src="' . $cart[$i]->TripImg . '" class="img-responsive"> <div class="products-price"> <small>$</small>' . $cart[$i]->price . ' </div> </div> <div class="col-lg-8 col-sm-12 products-content"> <div class="products-title"> ' . $cart[$i]->Title . ' </div> <div class="hidden-xs"> <div class="products-map"> <span class="glyphicon glyphicon-map-marker" aria-hidden="true"> 從 <a rel="#">' . $place[0] . '</a> 出發 , 到 '; $countStep = count_objects($cart[$i]->place); for ($j = 1; $j < $countStep; $j++) { if ($j != $countStep - 1) { echo ' <a rel="#">' . $place[$j] . '</a> <span class="glyphicon glyphicon-arrow-right" aria-hidden="true"></span>'; } else { echo ' <a rel="#">' . $place[$j] . '</a>'; } } echo '</span> </div> <div class="products-date"> <span class="glyphicon glyphicon-calendar" aria-hidden="true"> 出發日期: ' . $cart[$i]->StartDay . ',共' . $cart[$i]->DiffDate . '天 </span> </div> <div class="products-text"> ' . $cart[$i]->Content . '</div> </div> <hr class="hr0">
<?php function count_rows($pix) { $rows = 0; foreach ($pix as $r) { $rows++; } return $rows; } function count_objects($pix) { $objects = 0; foreach ($pix as $r) { foreach ($r as $o) { $objects++; } } return $objects; } $im = new Imagick('magick:rose'); $it1 = new ImagickPixelIterator($im); $it2 = ImagickPixelIterator::getPixelIterator($im); echo (count_rows($it1) == count_rows($it2) ? "match" : "no") . PHP_EOL; echo (count_objects($it1) == count_objects($it2) ? "match" : "no") . PHP_EOL; $it1->newPixelIterator(new Imagick('magick:rose')); echo 'done' . PHP_EOL;