本文整理汇总了PHP中Factory::getClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::getClass方法的具体用法?PHP Factory::getClass怎么用?PHP Factory::getClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Factory
的用法示例。
在下文中一共展示了Factory::getClass方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<html>
<p><h4>Login</h4></p>
<form method="post" action="login.php">
Username :
<p>
<input type="text" name="username"/>
</p>
Password :
<p>
<input type="password" name="password"/>
</p>
<input type="submit" name="submit" value="Login"/>
</form>
<?php
if (isset($_POST['submit'])) {
$username = $_POST['username'];
$password = $_POST['password'];
require_once '../class/Factory.php';
$account = Factory::getClass('userAccount');
$user = $account->login($username, $password);
}
?>
</html>
示例2: __construct
public function __construct()
{
$this->objUser = Factory::getClass("Db");
}
示例3: session_start
<?php
session_start();
?>
<html>
<p>
<a href="admin.php">Home</a>
</p>
<?php
require_once '../class/Factory.php';
$obj = Factory::getClass("userAccount");
$id = isset($_GET['id']) ? $_GET['id'] : '';
if ($id != '') {
$getData = $obj->getEditUser(array('id' => $id));
}
$mode = isset($_GET['q']) ? 'edit' : 'new';
?>
<form method="post" action="../proccess/processUser.php">
Nim :
<p>
<input type="text" name="nim" value="<?php
echo isset($getData->nim) ? $getData->nim : '';
?>
"/>
</p>
Nama :
<p>
<input type="text" name="nama" value="<?php
echo isset($getData->nama) ? $getData->nama : '';
?>
示例4: isset
$page = isset($_GET['nav']) ? $_GET['nav'] : 1;
$limit = 3;
$offset = (empty($page) or $page == 1) ? 0 : ($page - 1) * $limit;
$getData = $user->query("SELECT * FROM mhs LIMIT {$offset},{$limit}")->result();
$totalRows = $user->get('mhs')->num_rows();
foreach ($getData as $data) {
echo '
<tr>
<td>' . $data->nim . '</td>
<td>' . $data->nama . '</td>
<td>' . $data->alamat . '</td>
<td><a href="../proccess/delete.php?id=' . urlencode($data->id) . '">Delete</a> | <a href="add_user_view.php?q=edit&id=' . urlencode($data->id) . '">Edit</a></td>
</tr>
';
}
?>
</tbody>
</table>
</p>
<p>
<?php
$config = array('limit' => $limit, 'url' => $_SERVER['PHP_SELF'] . '?', 'total_data' => $totalRows, 'uri_segment' => $page);
$paging = Factory::getClass("Pagination");
echo $paging->create_page($config);
?>
</p>
</html>