douhang8991 2012-04-11 07:22
浏览 48
已采纳

PHP以有限的输出回响长串?

I have a variable of array containing such as these names;

// 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"
); 

And at the middle of my php body, i create For Loops. Iterating the array, and then echoing em out.

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/>';
}

Somehow, I just realized it right now, that What i obtained is NOT A WHOLE NAME as it's listed earlier from the array. Instead, What I got now is just a small piece of those names. Look! Here are the output names I obtained:

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

I tried to write FLUSH() at the end of my php script, and the output of those names are OK. But then it gives me another error, since I'm using Slim Framework. Is there another alternatives way rather than using FLUSH()?

  • 写回答

2条回答 默认 最新

  • dszpyf4859 2012-04-17 09:07
    关注

    The real quick answer for this is, by modifing the php.ini file;

    output_buffering = 4096
    implicit_flush = Off
    

    And then restarting the APache server. I dunno why but it works.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥60 pb数据库修改或者求完整pb库存系统,需为pb自带数据库
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路