草庐IT

file_str

全部标签

php - 使用 php file_get_content 函数发送参数

亲爱的,我如何使用phpfile_get_content函数发送参数。$id='123';$name='blah';$response=file_get_contents('http://localhost/abc/abc.php?id=$id&name=$name');echo$response;我需要将$id和name值发送到abc.php页面。这里传递的值不起作用。我也查了一下?id="$id"&name="$name"值。它也不起作用。但是straite参数works.say-$response=file_get_contents('http://localhost/abc/a

php - file_get_contents() 将 UTF-8 转换为 ISO-8859-1

我正在尝试从yahoo.com获取搜索结果.但是file_get_contents()将UTF-8字符集(雅虎使用的字符集)内容转换为ISO-8859-1。尝试:$filename="http://search.yahoo.com/search;_ylt=A0oG7lpgGp9NTSYAiQBXNyoA?p=naj%C5%A1%C5%A5astnej%C5%A1%C3%AD&fr2=sb-top&fr=yfp-t-701&type_param=&rd=pref";echofile_get_contents($filename);脚本为header('Content-Type:text/

PHP : How to create a string of image binary without saving it to a file?

我有一个图像变量,$im=imagecreatetruecolor(400,300);有没有办法在不将其保存到文件的情况下以jpeg格式获取此图像的二进制字符串?谢谢! 最佳答案 是的,这是可能的(即使没有输出缓冲)。它看起来没有记录,但您可以传递流资源而不是文件名。 关于PHP:Howtocreateastringofimagebinarywithoutsavingittoafile?,我们在StackOverflow上找到一个类似的问题: https://

PHP file_exists 但重命名失败 "No such file or directory..."?

这个问题不太可能帮助任何future的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况有关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visitthehelpcenter.关闭9年前。考虑到有问题的文件的创建有点滞后于有问题的函数,我尝试运行一个while循环来争取一点时间,然后再调用重命名。$no_file=1;while($no_file&&$no_file在这个配置中,我认为rename()只能在file_exists()返回true时被调用,但对于我的生活我无法弄清楚如何/为什么rename()被调用然后返回失败...PHPWa

php - 使用 Varien_File_Uploader 上传多个文件

这个问题和我之前的question有关我使用模板文件在管理员中创建了一个选项卡表单。模板文件内容为:ImagesRemovejQuery(document).ready(function(){jQuery('.add').click(function(){varwrapper=""+""+"Remove"+"";jQuery(wrapper).find('.remove').on('click',function(){jQuery(this).parent('.wrapper-tr').remove();});jQuery(wrapper).appendTo('.container')

PHP 使用 str_replace 替换或删除空行的简单方法

$line-out=str_replace('\r','',str_replace('\n','',$line-in));以上对我有用,但是,我在某处看到了一个[\n\r]示例,但我似乎找不到它。我只想去掉所有空白行。以上是在foreach循环中。感谢教导。 最佳答案 你不应该在变量名中使用-;)$line_out=preg_replace('/[\n\r]+/','',$line_in);$line_out=str_replace(array("\n","\r"),'',$line_in);手动输入:http://php.net/

PHP __FILE__ 继承

我正在尝试编写一种可以在使用文件完整路径的扩展类中使用的方法。但是,当我使用__FILE__时,我只会返回定义继承方法的类的路径。这是一个示例:foo.phpclassfoo{publicfunctiongetFullFile(){return__FILE__;}}酒吧.phpclassbarextendsfoo{publicfunctiongetFile(){return__FILE__;}}例子.php$foo=newfoo();echo$foo->getFullFile().PHP_EOL;$bar=newbar();echo$bar->getFullFile().PHP_EOL

php - SessionHandler::gc():ps_files_cleanup_dir |权限被拒绝 (13)

我在CentoOS(WHM/CPANEL)和Prestashop1.7中遇到PHP7问题系统给我这个消息:Noticeonline429infile/home/onywf3fr9a/public_html/app/cache/dev/classes.php[8]SessionHandler::gc():ps_files_cleanup_dir:opendir(/var/cpanel/php/sessions/ea-php70)失败:权限被拒绝(13) 最佳答案 背景当PHP尝试对过期的session进行垃圾回收,但包含session

php - 无法使用 str_replace 删除特殊字符

我有一个关于str_replace的小问题。我有一个带有破折号(-)的字符串,如下所示:Iwanttoremove-thedashhtml输出是Iwanttoremovethe–thedash我想这样做:$new_string=str_replace('-','',$string);我尝试用html_entity_decode解析字符串,用htmlspecialchars解析要删除的字符,但没有任何结果。我做错了什么?-编辑-这是我的脚本的完整代码:$title='SuperMarioGalaxy2-DebutTrailer';//FetchedfromtheDB,inth

Nginx 和 Dropbox 文件夹内的符号链接(symbolic link)根目录导致 "File not found."

原始问题Imetastrangeproblemwithnginx+php-fpm.Ifmyrootdirectorysettosomethinglike~/playground/apps/foo/public/,everythingworksfine.IfIsymlink~/playgroundto~/Dropbox/playgroundNginxrendersa"Filenotfound."string.Ifirstthoughtthatitwasapermissionsproblem,butitisn't(doublecheckedwithasimplephpfile)Somyqu