<?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;
?>
<html>
<body>
<div class="wrap">
<ul>
<li>task1</li>
<li>task2</li>
<li>task3</li>
<li>task4</li>
<li>task5</li>
<li>task6</li>
</ul>
<a href="#">more</a>
</div>
<script>
let start = 0;
let limit = 2;
function render(elements, start, limit) {
elements.forEach((el, index) => {
el.style.display = (index < start + limit) ? 'block' : 'none';
});
}
const elements = document.querySelectorAll('ul > li');
document.querySelectorAll('a')[0].onclick = () => {
start += limit;
render(elements, start, limit);
};
render(elements, start, limit);
</script>
</body>
</html>
<?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);