草庐IT

write-host

全部标签

php - 为什么我收到此错误通知 : Undefined index: host

我的示例代码在这里include'simple_html_dom.php';functionget_all_links($url){global$host;$html=newsimple_html_dom();$html->load(file_get_contents($url));foreach($html->find('a')as$a){$host1=parse_url($a->href);$host=parse_url($url);if($host1['host']==$host['host']){$data[]=$a->href;}}return$data;}$links=ge

php - 我可以使用什么替代 HTTP_HOST?

我必须显示当前服务器主机(在PHP中,但这不是很重要)。我不知道我在哪个主机上。如果没有安全问题,我该怎么做?如果我使用$_SERVER['HTTP_HOST'],它来自客户端,所以我不能相信这个信息(我认为它可以重写)。PS:我读过这篇文章:HowreliableisHTTP_HOST?但我没有找到任何回应(也许我没有正确搜索......) 最佳答案 为此目的使用$_SERVER['SERVER_NAME'],来自文档:Thenameoftheserverhostunderwhichthecurrentscriptisexecut

php - 如何修复错误 "Fatal error: Uncaught --> Smarty: unable to write file"?

我使用digitalocean将Prestashop从本地主机迁移到网站域,但是当我打开该网站时出现此错误Fatalerror:Uncaught-->Smarty:unabletowritefile/var/www/html/prestashop/cache/smarty/compile/a4/36/f1/wrt549a35e49b3b44_77591243我尝试将smarty文件夹的权限更改为755,但没有成功。我不知道如何修复它。 最佳答案 你的问题肯定是关于权限的。这取决于Apache和PHP的设置方式。首先,检查谁拥有这些文

PHP AWS SDK 3 错误 : AWS HTTP error: cURL error 6: Could not resolve host: s3. oregon.amazonaws.com

我正在尝试连接到AWS版本3SDK存储桶。但是,我收到以下错误:PHPFatalerror:Uncaughtexception'Aws\S3\Exception\S3Exception'withmessage'Errorexecuting"PutObject"on"https://s3.oregon.amazonaws.com/my-buekct-test/hello_world.txt";AWSHTTPerror:cURLerror6:Couldnotresolvehost:s3.oregon.amazonaws.com(seehttp://curl.haxx.se/libcurl/

php - 拉维尔 4 : how to write the correct nested controller for nested resource?

在Laravel4中,我希望创建一组restful资源如下:http://localhost/posts/1/commentshttp://localhost/posts/1/comments/1http://localhost/posts/1/comments/1/edit...所以我创建了两个Controller:PostsController和CommentsController(在同一层),路由写成如下:Route::resource('posts','PostsController');Route::resource('posts.comments','CommentsCon

php - 如何实现 Authorize.NET Hosted Payments iFrame & Laravel

我发现Authorize.NET提供的官方文档和github示例是一堆非常困惑的东西,您不需要这些东西。这篇文章是对过去几个小时工作的总结,希望对其他人有所帮助。本指南假定您不需要收据页面,并且希望在成功付款后自动将用户向前移动。 最佳答案 站点后端是Laravel(PHP),但这里几乎没有特定于Laravel的内容。首先要做的是添加Authorize.NETSDK:composerrequireauthorizenet/authorizenet然后我设置了一个接受订单的托管支付存储库,但您可以根据自己的喜好执行此操作,这会将托管表

PHP 银条 ORM : Duplicate key value violates unique constraint for DataObject write

我的网站上有一个功能,可以非常快速地将一堆值保存到相同的DataObject类型。大多数时候没问题,但偶尔会出错ERROR:duplicatekeyvalueviolatesuniqueconstraint...通读我看到的文档:SilverStripedoesnotusethedatabase'sbuilt-inauto-numberingsystem.Instead,itwillgenerateanewIDbyadding1tothecurrentmaximumID之前查看代码,它看起来像是从主键中检索最大数量,插入具有该ID的记录,然后设置DataObject的值并再次写入。在我

php - SMTP 错误 : Could not connect to SMTP host

我有这段代码,在我的本地服务器上一切正常。电子邮件发送没有任何问题。但是现在我将内容传递给网络服务器,我得到了这个错误...SMTPError:CouldnotconnecttoSMTPhost.服务器启用了SSL..正确吗?那么,问题是什么?$mail=newPHPMailer();$mail->IsSMTP();$mail->SMTPAuth=true;//enableSMTPauthentication$mail->SMTPSecure="ssl";//setstheprefixtotheservier$mail->Host="smtp.gmail.com";//setsGMAI

php - 是否可以更改 htaccess 中的 $_SERVER ['HTTP_HOST' ]?

关闭。这个问题是off-topic.它目前不接受答案。想改进这个问题吗?Updatethequestion所以它是on-topic用于堆栈溢出。关闭9年前。Improvethisquestion我有一个子域ABC.mydomain.com其$_SERVER['HTTP_HOST']我想更改为另一个域anotherdomain.com。Anotherdomain.com也是我的域名。是否可以使用.htaccess全局更改此变量($_SERVER['HTTP_HOST'])?如果是,怎么办?

php - 文件获取内容(): No such host is known error

我正在使用file_get_contents函数将URL转换为字符串:$contents=file_get_contents("http://google.com");但是,我收到以下错误:file_get_contents()[function.file-get-contents]:php_network_getaddresses:getaddrinfofailed:Nosuchhostisknown.如何在我的本地主机上解决这个问题? 最佳答案 您的“本地主机”无法将名称google.com解析为IP地址,这意味着您的机器无法/