本文整理汇总了PHP中pageController函数的典型用法代码示例。如果您正苦于以下问题:PHP pageController函数的具体用法?PHP pageController怎么用?PHP pageController使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pageController函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sayHello
function sayHello()
{
$message = "Hello";
return $message;
}
function pageController()
{
// Initialize an empty data array.
$data = [];
// Add data to be used in the html view.
$data['message'] = sayHello();
// Return the completed data array.
return $data;
}
// Call the pageController function and extract all the returned array as local variables.
extract(pageController());
// Only use echo, conditionals, and loops anywhere within the HTML.
?>
<!doctype html>
<html>
<head>
<title>PHP + HTML</title>
</head>
<body>
<h1><?php
echo $message;
?>
</h1>
</body>
</html>
示例2: header
die;
}
if (Input::has('username') && Input::has('password')) {
$username = Input::get('username');
$password = Input::get('password');
if (Auth::attempt($username, $password)) {
Auth::user();
header('location: /authorized.php');
die;
} else {
echo 'Those are not valid credentials!';
}
}
}
// close pageController
pageController();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Login Page</title>
<link rel="stylesheet" href="/css/basic.css">
</head>
<body>
<form method="POST">
<label for="username">User Name</label>
<input type="text" name="username" value="<?php
escape('username');
示例3: pageController
<?php
function pageController()
{
$adjectives = ['beautiful', 'accurate', 'adorable', 'admirable', 'big', 'busy', 'harsh', 'boring', 'brilliant', 'colorful'];
$noun = ['Apple', 'Pear', 'Banana', 'Cherry'];
$rand_adjectives = $adjectives[array_rand($adjectives)];
$rand_noun = $noun[array_rand($noun)];
$server_name = "{$rand_adjectives}-{$rand_noun}";
return $server_name;
}
$new = pageController();
?>
<!doctype html>
<html>
<head>
<meta charset = "utf-8">
<title>server-name-generator.php</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<style>
input {
font-weight: bolder;
text-align: center;
font-style: italic;
}
示例4: pageController
<?php
require '../../input.php';
function pageController()
{
$confirmedPingSwing = Input::get('click');
$confirmedPongSwing = Input::get('click');
$random = mt_rand(0, 100);
return ['random' => $random, 'confirmedPingSwing' => $confirmedPingSwing, 'confirmedPongSwing' => $confirmedPongSwing];
}
$data = pageController();
extract($data);
?>
<html>
<head>
<title>Ping</title>
</head>
<body class = 'gameover'>
<h1>Pings Turn!!</h1>
<h1>Round: <?php
echo $confirmedPingSwing;
?>
</h1>
<h3>Hit</h3>
<?php
if ($random > 10) {
?>
<a href="/php/pong.php?click=<?php
echo $confirmedPingSwing + 1;
?>
" name='up_one'>Swing !!!</a>
示例5: is_numeric
$page = $page > 1 ? $page : 1;
// Is value greater than 0 if not set to 1.
$page = is_numeric($page) ? $page : 1;
// If input not numeric then return 1.
$page = $page <= $max_page ? $page : $max_page;
// Offset
$offset = $page * $limit - $limit;
$selectAll = "SELECT * FROM national_parks LIMIT {$limit} OFFSET {$offset}";
$stmt = $dbc->query($selectAll);
$stmt->bindValue(':limit', $limit, PDO::PARAM_INT);
$stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
$stmt->execute();
$parks = $stmt->fetchAll(PDO::FETCH_ASSOC);
return array('page' => $page, 'parks' => $parks, 'errors' => $errors, 'max_page' => $max_page, 'limit' => $limit);
}
extract(pageController($dbc));
// $limit = Input::has('limit') ? Input::get('limit') : 4;
// if(!empty($_POST)) {
// echo 'notempty';
// if($park != '' && $date_established != '' && $area_in_acres != '' && $description != '' && $location != '') {
// echo 'inserted';
// insertPark($dbc, $park, $date_established, $description, $area_in_acres, $location);
// }
// }
// }
// $max_page = ceil($count / $limit)
// SELECT location
// FROM national_parks
// LIMIT 5 OFFSET 50;
// var_dump($parks);
?>
示例6: insertListing
// add inputed data into datebase
if (Input::notEmpty('item_name') && Input::notEmpty('price') && Input::notEmpty('image') && Input::notEmpty('description')) {
// if no errors were thrown runs insert park
if (empty($errors)) {
insertListing($dbc, $item_name, $price, $image, $description);
}
// elseif (Input::notEmpty('deleted_item_name')) {
// $deleteListing($dbc);
// }
// else {
// echo "Please make a valid entry.";
// }
}
}
}
pageController($dbc);
?>
<!doctype html>
<html lang="en">
<head>
<?php
require_once '../views/partials/head.php';
?>
<title>Creating Ad</title>
</head>
<body>
<div class="container">
<?php
require_once '../views/partials/navbar.php';
?>