Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP回显有限输出的长字符串?_Php_Echo_Partial_Flush - Fatal编程技术网

PHP回显有限输出的长字符串?

PHP回显有限输出的长字符串?,php,echo,partial,flush,Php,Echo,Partial,Flush,我有一个数组的变量,包含这样的名称 // Listing ENTITIES $entitiesTable = array( 1 => "user", 2 => "group", 3 => "customer", 4 => "supplier", 5 => "terminal", 6 => "order", 7 => "invoice", 8 => "invoice detail",

我有一个数组的变量,包含这样的名称

// 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循环迭代数组,然后回声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/>';
}
我尝试在我的php脚本的末尾编写FLUSH(),这些名称的输出是正常的。但是它给了我另一个错误,因为我使用的是瘦框架。
除了使用FLUSH(),还有其他替代方法吗?

我想您正在寻找一种叫做, 下面是一个字符串到camelcase函数:

function to_camel_case($str, $capitalise_first_char = false) {
  if($capitalise_first_char) {
    $str[0] = strtoupper($str[0]);
  }
  $func = create_function('$c', 'return strtoupper($c[1]);');
  return preg_replace_callback('/_([a-z])/', $func, $str);
}

摘自:

真正快速的答案是修改php.ini文件

output_buffering = 4096
implicit_flush = Off

然后重新启动APache服务器。我不知道为什么,但它可以工作。

可能是一些奇怪的输出缓冲。在脚本的末尾写ob_flush(),看看它是否有效。是的,我已经试过了,但似乎这是Slim框架在处理ECHO时的局限性,因为它没有执行Slim()->run()方法。我的回声有限。谢谢你的骆驼案@Dan Lee。。。但问题在于“回声过程”。它没有正确地回显所有文本。
output_buffering = 4096
implicit_flush = Off