当前位置: 首页>>代码示例>>PHP>>正文


PHP Http::getParameter方法代码示例

本文整理汇总了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'));
 }
开发者ID:poliander,项目名称:janeiro,代码行数:7,代码来源:HttpTest.php

示例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/>
开发者ID:amad4biz,项目名称:invoices,代码行数:31,代码来源:payment-edit.php

示例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;
 }
开发者ID:amad4biz,项目名称:invoices,代码行数:44,代码来源:Invoice.php

示例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;
 }
开发者ID:amad4biz,项目名称:invoices,代码行数:28,代码来源:Payment.php


注:本文中的Http::getParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。