php修改写入路径解决方案

WBOY
Release: 2016-06-13 13:42:52
Original
1364 people have browsed it

php修改写入路径

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
<?php function getImage($url,$filename="",$ext) { 
  if(!$url) return false;

  $filename=date("dMYHis").$ext; 

  ob_start(); 
  readfile($url); 
  $img = ob_get_contents(); 
  ob_end_clean(); 
  $fp2=@fopen($filename, "a"); 
  fwrite($fp2,$img); 
  fclose($fp2); 

  return $filename; 
} 
$link=$_GET['url'];
$ext=$_GET['ext'];

$img=getImage("$link","","$ext");

if($img)
echo "<p>".$img."<br><a href=".%24img.">Enter</a>";
else
echo "false<br>url<br>ext<br>";
?>

Copy after login


目前可以传入连接和文件类型,我想再添加写入路径的话怎么改
例如可以自定义写入路径 $path=$_GET['path'];

------解决方案--------------------
$link 这个不就是你的路径?
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template