本文整理汇总了PHP中Quote::newQuote方法的典型用法代码示例。如果您正苦于以下问题:PHP Quote::newQuote方法的具体用法?PHP Quote::newQuote怎么用?PHP Quote::newQuote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quote
的用法示例。
在下文中一共展示了Quote::newQuote方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: User
require_once "../models/Base.php";
require_once "../models/User.php";
require_once "../models/Quote.php";
// $user = new User;
$user = new User();
$quote = new Quote();
$user->migrate();
$quote->migrate();
if (isset($_SERVER["SERVER_NAME"])) {
die("This script must be run from the command line.");
}
require "../db/bootstrap.php";
print "Initializing the quotes database...";
$first = $quote->findByQuote($quotes[0]["quote"]);
if ($first) {
print " (already filled) ";
} else {
foreach ($quotes as $q) {
$quote->newQuote($q["who"], $q["quote"], 1);
}
}
print "done\n\n";
$stdin = fopen("php://stdin", "r");
print "Let's create a new user\n";
print "Please enter the administrator's email: ";
$email = trim(fgets($stdin));
print "Administrator's password: ";
$password = trim(fgets($stdin));
$user->newUser($email, $password, 1);
fclose($stdin);
示例2: Quote
<?php
if ($_POST["quote"] && $_POST["who"]) {
require_once "../models/Base.php";
require_once "../models/Quote.php";
$quote = new Quote();
$quote->newQuote($_POST["who"], strip_tags($_POST["quote"]));
$message = "Your quote has been added, thank you. " . $_POST["who"];
}
$title = "Add a quote";
require "header.php";
?>
<?php
if ($message) {
?>
<h1><?php
echo $message;
?>
</h1>
<?php
}
?>
<?php
require "form.php";
?>
<?php
require "footer.php";