本文整理汇总了PHP中Http::getParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::getParameter方法的具体用法?PHP Http::getParameter怎么用?PHP Http::getParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Http
的用法示例。
在下文中一共展示了Http::getParameter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetParameters
public function testGetParameters()
{
$_SERVER['REQUEST_METHOD'] = 'GET';
$_GET['captain'] = 'kirk';
$request = new Http();
$this->assertEquals('kirk', $request->getParameter('captain'));
}
示例2: stdClass
<?php
if (!isset($payment)) {
$payment = new stdClass();
$payment->invoice_id = Http::getParameter('invoice_id', 'int');
$payment->type = '';
$payment->billed = 0;
$payment->total = 0;
$payment->description = 'Enter a description here...';
}
?>
<form method="POST" action="<?php
echo $action;
?>
" id="payment-edit">
<div id="messages"></div>
<fieldset>
<legend>Payment</legend>
<input type="hidden" name="Payment[invoice_id]" value="<?php
echo $payment->invoice_id;
?>
" />
<label>Date (DDMMYYYY)</label>
<?php
$billed = $payment->billed ? Entry::__getStringFromDateTime($payment->billed) : '';
?>
<input type="text" name="Payment[billed]" value="<?php
echo $billed;
?>
" />
<span class="help"></span><br/>
示例3: create
/**
* Creates an invoice and related items
*/
public function create()
{
$post = Http::getParameter('POST');
if (count($this->validate()) > 0) {
throw new Exception('Invalid data entered', 400);
}
// create invoice
if ($this->id == 'new') {
$this->id = null;
}
$this->status = 'Drafted';
$id = parent::create();
// create entries
$this->entries = array();
foreach ($post['Invoice']['Entry'] as $entry) {
$Entry = new Entry();
$Entry->__bind($entry);
$Entry->invoice_id = $id;
$Entry->billed = Entry::__getDateTimeFromString($Entry->billed);
if (!array_key_exists('total', $entry)) {
$Entry->total = round($entry['quantity'] * $entry['amount_per'], 2);
}
$Entry->create();
$this->entries[] = $Entry;
}
// create discounts
$this->discounts = array();
foreach ($post['Invoice']['Discount'] as $discount) {
$Discount = new Discount();
$Discount->__bind($discount);
$Discount->invoice_id = $id;
$Discount->create();
$this->discounts[] = $Discount;
}
// update total
$this->update_total();
// update cache, see libraries/misc.php
delete_cache_entry('invoices', $id);
// return
return $id;
}
示例4: create
/**
* Creates a payment
* @return int
*/
public function create()
{
$post = Http::getParameter('POST');
if (count($this->validate()) > 0) {
throw new Exception('Invalid data entered', 400);
}
// should have been handled by AJAX
// create invoice
if ($this->id == 'new') {
$this->id = null;
}
$this->billed = Entry::__getDateTimeFromString($this->billed);
$this->description = trim($this->description);
$id = parent::create();
// recalculate invoice total
$invoice = new Invoice($this->invoice_id);
$invoice->update_total();
// update cache, see libraries/misc.php
delete_cache_entry('payments', $id);
// send payment receipt
$this->mail();
// return
return $id;
}