草庐IT

data-files

全部标签

php - file_get_contents 在生产服务器上不工作,在本地很好

我有一个从远程服务器获取图像的PHP脚本,这样我就可以使用HTML5canvasAPI对其进行操作。getMessage();}}elsedie('Unknownrequest');?>一个典型的请求是这样的:fetch_image.php?url=http://example.com/images/image.png在我的本地服务器上一切正常,但生产服务器给我这个错误:NetworkError:500InternalServerError.错误日志记录了这条消息:PHPWarning:Cannotmodifyheaderinformation-headersalreadysent.我

php - move_uploaded_file 无法打开流和权限被拒绝错误

我正在尝试上传文件,但我的浏览器出现以下错误:Warningmove_uploaded_file(public/upload/udesignwptheme138.zip)[function.move-uploaded-file]:failedtoopenstream:Permissiondeniedin/home/monivbr/public_html/classes/system/Util.phponline1803Warning:move_uploaded_file()[function.move-uploaded-file]:Unabletomove'/tmp/phpJtBlbi

php - AMQPRuntimeException : Error reading data. 收到 0 而不是预期的 7 字节

它一直在工作,但现在它不再工作了!我正在使用php-amqplib和RabbitMQ。当我尝试创建一个新的AMQP连接时:$connection=newAMQPConnection('localhost',5672,'username','password');库中导致此错误的代码是:publicfunctionread($n){$res='';$read=0;while($readsock)&&(false!==($buf=fread($this->sock,$n-$read)))){if($buf===''){continue;}$read+=strlen($buf);$res.=

PHP - 字符串中带有变量的 file_get_contents()?

我正在尝试在收到此订单时通过PHPMailer将订单通过电子邮件发送给客户。我试过这样做:$email_page=file_get_contents("email_order_html.php?order=$order_id");我想以字符串形式获取此页面的内容,以便我可以使用PHPMailer发送此内容,但此函数不会执行该页面,因为其中包含变量$order_id,我该如何解决此问题? 最佳答案 您只能在将file_get_contents与UrlAwareStreamWrapper一起使用时添加查询参数,例如它适用于http://

php - 即使 file_exists() 声明文件存在,require() 也会失败

这是我的代码:if(file_exists('config.php')){require('config.php');//Thisisline38}以某种方式产生错误:Warning:require(config.php)[function.require]:failedtoopenstream:Nosuchfileordirectoryin/path/name/file.phponline38这怎么可能?更新:以下确实有效:if(file_exists(getcwd().'/config.php')){require(getcwd().'/config.php');}

php - 密码/商业 secret 算法 : Are they safe in php files?

我的网站是使用php文件构建的。我在这些文件中使用了商业secret算法,我的数据库根密码也存储在这些php文件中。我的数据库用于存储许多客户的私有(private)医疗数据。这是否被认为是安全的设置?任何人都可以从我的网络服务器下载php源代码,因此可以访问我的rootmysql密码吗?我在ubuntu8.04和mysql5上运行apache2.0和php5。谢谢。 最佳答案 如果您在美国存储医疗数据,您将受到特定、严格的securityrequirements.其他国家可能有类似规定。如果不是专家,我严重怀疑您能否通过您描述的设

php - 处理多维 $_FILES 数组

我有以下$_FILES数组用于从支持表单进行处理Array([file]=>Array([name]=>Array([0]=>Test.jpg[1]=>Test.doc[2]=>Test.php[3]=>)[type]=>Array([0]=>image/jpeg[1]=>image/jpeg[2]=>image/jpeg[3]=>)[tmp_name]=>Array([0]=>/tmp/phpCO0vSD[1]=>/tmp/phpEFpp3Q[2]=>/tmp/phpwN4Iwc[3]=>)[error]=>Array([0]=>0[1]=>0[2]=>0[3]=>4)[size]=

PHP 包含 - 无法打开流 : No such file

我用HTML编写了一个网站,但后来我想将页眉和导航栏部分放在一个文件中,所以我只需要更改一次即可。我将所有页面更改为.php并添加了php包含。但是,现在我在放入文件夹的页面上出现错误,因此我可以创建简洁的链接。头文件:/test/assets/header.php作品:/test/index.php包含抛出错误:/test/company/index.php包含错误:Warning:include(/test/assets/header.php)[function.include]:failedtoopenstream:NosuchfileordirectoryWarning:inc

php - zf2 插入使用 $db->insert($table, $data);风格

您好,有什么方法可以在zf2上使用zf1样式将数据插入到数据库表中吗?$db->insert('tablename',$data);其中$data是一个包含(列、值)的关联数组谢谢 最佳答案 在zf2中插入:useZend\Db\Sql\Sql;$sql=newSql($this->dbAdapter);$insert=$sql->insert('table');$newData=array('col1'=>'val1','col2'=>'val2','col3'=>'val3');$insert->values($newData)

php - 使用 simplexml_load_file() 加载压缩的 XML 文件

我正在尝试使用simplexml_load_file()PHP函数加载一个gzip压缩的XML文件,但我不知道如何解码它以便我可以使用其中的数据。 最佳答案 PHP有supportforzlibcompression内置,只需在文件的路径前加上gzip数据compress.zlib://就可以了:$xml=simplexml_load_file("compress.zlib://test.xml");像魅力一样工作。 关于php-使用simplexml_load_file()加载压缩的X