我有一個變量數組包含這些名稱;PHP回聲有限的輸出字符串?
// Listing ENTITIES
$entitiesTable = array(
1 => "user",
2 => "group",
3 => "customer",
4 => "supplier",
5 => "terminal",
6 => "order",
7 => "invoice",
8 => "invoice detail",
9 => "invoice offer",
10 => "invoice offer detail",
11 => "quotation",
12 => "quotation detail",
13 => "quotation offer",
14 => "quotation offer detail",
15 => "purchase order",
16 => "purchase order detail",
17 => "purchase order request",
18 => "purchase order request detail",
19 => "sales order",
20 => "sales order detail",
21 => "delivery order",
22 => "delivery order detail",
23 => "sales return",
24 => "sales return detail",
25 => "purchase return",
26 => "purchase return detail",
27 => "item",
28 => "category",
29 => "unit measurement",
30 => "last activity",
31 => "rack",
32 => "alert",
33 => "filter",
34 => "prefix code",
35 => "system",
36 => "company profile"
);
而在我的php身體的中間,我創建了For Loops。 迭代該數組,然後呼應 em出來。
foreach ($entitiesTable as $singleEntity){
if(preg_match($regexUsed, $singleEntity)){
$pluralEntity = preg_replace($regexUsed, 'ies', $singleEntity);
} else {
$pluralEntity = $singleEntity . 's';
}
// Replacing spaces with a dash character and capitalize the first word
$pluralEntityWOSpace = ucwords($pluralEntity);
$pluralEntityWOSpace = str_ireplace(" ","" , $pluralEntityWOSpace);
$pluralEntityWDash = str_ireplace(" ","-" , $pluralEntity);
$singleEntityWOSpace = ucwords($singleEntity);
$singleEntityWOSpace = str_ireplace(" ","" , $singleEntityWOSpace);
echo $singleEntityWOSpace . '<br/>';
}
不知怎的,我才意識到它的權利,即我得到什麼不是的全名,因爲它是從早期的數組中列出。相反,我現在得到的只是這些名字中的一小部分。看! 下面是我得到的輸出名稱:
User
Group
Customer
Supplier
Terminal
Order
Invoice
InvoiceDetail
InvoiceOffer
InvoiceOfferDetail
Quotation
QuotationDetail
QuotationOffer
QuotationOfferDetail
PurchaseOrder
PurchaseOrderDetail
PurchaseOrderRequest
PurchaseOrderRequestDetail
SalesOrder
SalesOrderDetail
DeliveryOrder
DeliveryOrderDetail
SalesReturn
SalesReturnDetail
PurchaseReturn
PurchaseReturnDetail
Item
Category
UnitMeasurement
LastActivit
我試着寫FLUSH()我PHP腳本的結束,這些名稱的輸出都OK。但後來它給我另一個錯誤,因爲我使用苗條框架。 是否有另一種替代方法,而不是使用FLUSH()?
可能有些奇特的輸出緩衝。在腳本的末尾寫ob_flush()以查看是否有效。 – 2012-04-11 07:37:34
雅我已經試過了,但似乎它是Slim框架的限制,當我們在處理ECHO時,它尚未執行Slim() - > run()方法。 我的迴應是有限的。 – gumuruh 2012-04-17 09:03:24