<?php
$json = "{ 'name1' : 'value' , 'name2' : 'value' , 'name3' : 'value' , 'name4' : 'value' }";
print_r( json_decode(str_replace("'", '"', $json), true) );
error_reporting(-1);
в начале кода и смотрите что не так.exit(header('Location: /error404/'));
ignore_user_abort(1);
header("Connection: close");
header("Content-Length: 0");
ob_end_flush(); flush();
function daemon () {
while(1) {
//somecode
usleep(500);
}
}
register_shutdown_function('daemon');
exit;
ignore_user_abort(1);
header("Connection: close");
header("Content-Length: 1");
echo '1';
ob_end_flush(); flush();
while(1) {
//somecode
usleep(500);
}
register_shutdown_function('file_get_contents', 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
exit;
<IfModule mod_fcgid.c>
AddHandler fcgid-script .php
</IfModule>
<IfModule mod_php5.c>
AddHandler application/x-httpd-php .php
</IfModule>
AllowOverride All
function custom_split($str) {
$parts = preg_split('/(?<![^\\\\]\\\\):/', $str);
array_walk($parts, function(&$v) { $v = str_replace('\\:', ':', $v); });
return $parts;
}
var_dump(custom_split('a:b:c:d\\:h:g'));
var_dump(custom_split('a:b:c:d\\\\:h:g'));
> array (size=5)
> 0 => string 'a' (length=1)
> 1 => string 'b' (length=1)
> 2 => string 'c' (length=1)
> 3 => string 'd:h' (length=3)
> 4 => string 'g' (length=1)
> array (size=6)
> 0 => string 'a' (length=1)
> 1 => string 'b' (length=1)
> 2 => string 'c' (length=1)
> 3 => string 'd\\' (length=3)
> 4 => string 'h' (length=1)
> 5 => string 'g' (length=1)