<?php
if($_FILES) {
print_r($_FILES);
die();
}
?>
<html>
<body>
<form method="POST" enctype="multipart/form-data">
<input type="file" name="file[]" multiple>
<button type="submit">LOAD</button>
</form>
</body>
</html>
Array
(
[file] => Array
(
[name] => Array
(
[0] => 6FYITcA2Grs.jpg
[1] => 7Vbe6k311ns (1).jpg
)
[type] => Array
(
[0] => image/jpeg
[1] => image/jpeg
)
[tmp_name] => Array
(
[0] => /private/var/folders/7r/hm0mck8s795dmctppqh7bgwm0000gn/T/phpAS3jPp
[1] => /private/var/folders/7r/hm0mck8s795dmctppqh7bgwm0000gn/T/phpfkqzQa
)
[error] => Array
(
[0] => 0
[1] => 0
)
[size] => Array
(
[0] => 278560
[1] => 50086
)
)
)
<?php
/*
*POST запрос при помощи file_get_contents
*/
//строка с POST данными
$data='a=1&b=2';
//задаем контекст
$context = stream_context_create(
array(
'http'=>array(
'header' => "User-Agent: Brauzer 2/0\r\nConnection: Close\r\n\r\n",
'method' => 'POST',
'content' => $data
)
)
);
$contents = file_get_contents("http://site.ru", false ,$context);
echo $contents;
?>
<?php
class PrivateClass
{
private function privateMethod()
{
return 'никогда так не делайте';
}
}
$object = new PrivateClass();
$reflector = new ReflectionObject($object);
$method = $reflector->getMethod('privateMethod');
$method->setAccessible(true);
echo $method->invoke($object);
foreach($_POST['orange'] as $k=>$orange) {
$pink = $_POST['pink'][$k];
$blue = $_POST['blue'][$k];
//do something with $orange, $pink, $blue
}