本文整理汇总了PHP中Photo::find_all方法的典型用法代码示例。如果您正苦于以下问题:PHP Photo::find_all方法的具体用法?PHP Photo::find_all怎么用?PHP Photo::find_all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Photo
的用法示例。
在下文中一共展示了Photo::find_all方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
require_once '../base.php';
require_once './models/user.php';
require_once './models/photo.php';
ActivePhp\Base::establish_connection(array('host' => 'localhost', 'database' => 'test_php', 'username' => 'root', 'password' => ''));
$rc = new Activephp\ResultCollection(Photo::find_all());
echo "<br />";
echo $rc->to_xml();
$users = User::find_all();
$user = $users[0];
echo '<pre>';
print_r($users);
var_dump($user);
echo 'photos<br/>';
foreach ($user->photos() as $photo) {
print_r($photo);
echo "id<p>";
echo $photo->id();
echo "<p> " . $photo->file() . " </p>";
}
echo 'end photos<br/>';
$photos2 = Photo::find(array(1, 2));
var_dump($photos2);
echo "USer start<br/>";
var_dump($photos2[0]->user());
echo "user end<br/>";
$user2 = User::find($user->id());
var_dump($user2);
var_dump($user2->photos());
try {
示例2: urlencode
<div class="col-md-12">
<table class="table table-hover">
<thead>
<tr>
<th>Photo</th>
<th>ID</th>
<th>Filename</th>
<th>Title</th>
<th>Size</th>
<th>Comments</th>
</tr>
</thead>
<tbody>
<?php
$photos = Photo::find_all();
$output = "";
$blank = " ";
foreach ($photos as $photo) {
$output .= "<tr>";
$output .= "<td style='text-center'><img class='admin-photo-thumbnail' src=\"{$photo->picture_path()}\" alt=''>";
$output .= "<div class='picture_link'>";
$output .= "<a href='delete_photo.php?id=" . urlencode($photo->id) . "'>Delete</a>{$blank}";
$output .= "<a href='edit_photo.php?id=" . urlencode($photo->id) . "'>Edit</a>{$blank}";
$output .= "<a href='../photo.php?id=" . urlencode($photo->id) . "'>View</a>{$blank}";
$output .= "</div>";
$output .= "</td>";
// $output.="<td><img src=\"{$photo->picture_path()}\" width='80' height='60' alt=''></td>" ;
$output .= "<td>{$photo->id}</td>";
$output .= "<td>{$photo->filename}</td>";
$output .= "<td>{$photo->title}</td>";
示例3:
<div class="col-xs-12">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Photo</th>
<th>Id</th>
<th>Filename</th>
<th>Title</th>
<th>Size</th>
<th>Comments</th>
</tr>
</thead>
<tbody>
<?php
$photo_found = Photo::find_all();
?>
<?php
foreach ($photo_found as $photo) {
?>
<tr>
<td>
<img class="img-thumbnail img-responsive thumb-table" src ="<?php
echo $photo->picture_path();
?>
"/>
<div class="action_links">
<a class="delete_link" href="delete_photo.php?id=<?php
echo $photo->id;
?>