search

Home  >  Q&A  >  body text

Problems with phpstudy environment php7 (str_getcsv function)

In the environment of
$a1='"上旬","中旬","下旬"';//这种写法输出错误
//$a2='上旬,中旬,下旬';这种写法输出是正确的
print_r(str_getcsv($a1));
-----------结果如下---------------
Array
(
    [0] => 上旬",中旬"
    [1] => 下旬"
)

--------------正确应该如下-------------
Array
(
    [0] => 上旬
    [1] => 中旬
    [2] => 下旬"
)

php7 (all UTF-8 encoding), what is the problem? Does this writing method of $a1 have this problem when running in other integrated environments or Linux PHP environment?

There is an article with a similar problem saying this http://blog.csdn.net/chunyuan314/article/details/61938901 (transcoding does not work)

iMpérfecτiMpérfecτ2503 days ago880

reply all(2)I'll reply

  • iMpérfecτ

    iMpérfecτ2018-03-05 19:36:10

    This should be a problem with the php version of phpstudy (has any changes been made), wampserver does not have this problem

    reply
    0
  • iMpérfecτ

    iMpérfecτ2018-03-05 18:13:41

    There are no quotation marks in the last part of the array, which is a typo

    reply
    0
  • Cancelreply