本文整理汇总了PHP中Symfony\Component\DomCrawler\Form::getFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::getFiles方法的具体用法?PHP Form::getFiles怎么用?PHP Form::getFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\DomCrawler\Form
的用法示例。
在下文中一共展示了Form::getFiles方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeRequestUsingForm
protected function makeRequestUsingForm(Form $form)
{
$files = [];
$plainFiles = $form->getFiles();
foreach ($plainFiles as $key => $file) {
$files[$key] = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['size'], $file['error'], true);
}
return $this->makeRequest($form->getMethod(), $form->getUri(), $form->getValues(), [], $files);
}
示例2: convertUploadsForTesting
/**
* Convert the given uploads to UploadedFile instances.
*
* @param \Symfony\Component\DomCrawler\Form $form
* @param array $uploads
* @return array
*/
protected function convertUploadsForTesting(Form $form, array $uploads)
{
$files = $form->getFiles();
$names = array_keys($files);
$files = array_map(function (array $file, $name) use($uploads) {
return isset($uploads[$name]) ? $this->getUploadedFileForTesting($file, $uploads, $name) : $file;
}, $files, $names);
return array_combine($names, $files);
}
示例3: makeRequestUsingForm
/**
* Make a request to a URL using form parameters.
*
* @param Form $form
* @return static
*/
protected function makeRequestUsingForm(Form $form)
{
return $this->makeRequest($form->getMethod(), $form->getUri(), $form->getValues(), [], $form->getFiles());
}
示例4: convertFormFiles
/**
* Converts form files to UploadedFile instances.
*
* @param Form $form
* @return array
*/
protected function convertFormFiles(Form $form)
{
$files = $form->getFiles();
$names = array_keys($files);
$files = array_map(function ($file, $name) {
if (isset($this->files[$name])) {
$absolutePath = $this->files[$name];
$file = new UploadedFile($file['tmp_name'], basename($absolutePath), $file['type'], $file['size'], $file['error'], true);
}
return $file;
}, $files, $names);
return array_combine($names, $files);
}
示例5: convertUploadsForTesting
/**
* Convert the given uploads to UploadedFile instances.
*
* @param \Symfony\Component\DomCrawler\Form $form
* @param array $uploads
* @return array
*/
protected function convertUploadsForTesting(Form $form, array $uploads)
{
$files = $form->getFiles();
$names = array_keys($files);
$files = array_map(function (array $file, $name) use($uploads) {
return isset($uploads[$name]) ? $this->getUploadedFileForTesting($file, $uploads, $name) : $file;
}, $files, $names);
$uploads = array_combine($names, $files);
foreach ($uploads as $key => $file) {
if (preg_match('/.*?(?:\\[.*?\\])+/', $key)) {
$this->prepareArrayBasedFileInput($uploads, $key, $file);
}
}
return $uploads;
}