PHP 板


LINE

看板 PHP  RSS
※ 引述《zuo3 (完美的一天)》之铭言: : 标题: [请益] 有关include的写法? : 时间: Mon Oct 15 23:00:56 2007 : : 这应该是非常简单的问题吧 : 但是我一直搞不定(因为完全不懂php) : 问题是这样的 : 在http://***.***.**/content/section01/item01.php 的网页中 : 要include(http://***.***.**/content/menu.php) : 但是网页显示是 : Warning: include() [function.include]: URL file-access is disabled in the : server configuration in D:\WebRoot\content\section02\item03.php on line 2 : Warning: include(http://***.***.**/content/menu.php) [function.include]: : failed to open stream: no suitable wrapper could be found in : D:\WebRoot\content\section02\item03.php on line 2 这种错误很显然是因为allow_url_include没有打开(disabled in configuration) : 但如果尝试 直接改为 include(menu.php) 并把menu.php 移至 section01资料夹中 : : 便可以直接开启 但总觉得这样很笨 且原始的写法并非如此 也维护不易 我个人觉得这样子并不笨,反而是最理想的作法 除非你是另外一些档案"一定"得摆在另一个server里面 这样的情况下使用readfile来读内容或着AJAX都比直接include好... 直接include一个URL十分危险... : 我知道这应该是很简单的问题 而且也是很蠢的问题 而且该自己好好爬文 : 但是.......我根本不懂php 真的很抱歉 请各位大大帮个忙 我会自d这种废文的 : ps1 这是用appserv 架站的 : ps2 这是承继既有的网站架构 : ps3 这是老板指派给我的鸟工作--把关闭半年左右的网站重新架起 : 推 buganini:不笨啊....倒是原本的写法怪怪的 10/15 23:08 : → buganini:而且注意你include url是php执行後的结果喔 10/15 23:08 并不是这样子,是可以include source code的... http://tw2.php.net/include states: Security warning Remote file may be processed at the remote server (depending on the file extension and the fact if the remote server runs PHP or not) but it still has to produce a valid PHP script because it will be processed at the local server. If the file from the remote server should be processed there and outputted only, readfile() is much better function to use. Otherwise, special care should be taken to secure the remote script to produce a valid and desired code. 因为allow_url_include所引起的相关安全性与入侵问题并不小 强烈建议不要打开这个功能,也不要做这麽危险的include... : → buganini:你可以include('../menu.php')不用搬档案 10/15 23:09 : → buganini:不然就去把php.ini里面allow_url_include打开 10/15 23:09 --



※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.248.110
1F:→ zuo3:虾密url_include 这麽危险 那我还是把他off起来 10/15 23:31
2F:推 buganini:include('http://x.x.x.x/a.php');会是把a.php执行後的 10/15 23:32
3F:→ buganini:结果include进来没错啊.... 10/15 23:32
4F:→ zuo3:一个一个慢慢修正为../memu.php (天阿 有90个要改) 10/15 23:32
5F:推 zuo3:感谢 buganini&ybite 大大 问题解决了 (问题解决原文删除) 10/15 23:38
6F:推 buganini:eval('?>'.file_get_contents($url).'<?php '); 10/15 23:40
7F:→ buganini:可以用allow_url_fopen替代allow_url_include 10/15 23:41
8F:→ buganini:不过一样危险就是了.... 10/15 23:42







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:Boy-Girl站内搜寻

TOP