Can't convert 'binary' string to 'regular' string

前端 未结 1 1204
孤独总比滥情好
孤独总比滥情好 2021-01-27 05:23

I\'m reading from a file through \'file_get_contents\'. After exploding the content, one of the elements is presented this way when I dump it:

dd($myVariable);
<         


        
相关标签:
1条回答
  • 2021-01-27 06:08

    You would need to unpack the binary data into a readable string using the unpack function (http://php.net/manual/en/function.unpack.php)

    Example for a string:

    $var = b"binary";
    $unpacked = unpack("a*", $var); // "a*" stands for as much as NUL-padded strings as possible
    var_dump($unpacked);
    
    0 讨论(0)
提交回复
热议问题