2012-03-14 61 views
0

我使用的wiki软件:DokuWiki的和自安装模板:http://www.dokuwiki.org/template:monobookPHP parse_ini_file在Windows PHP 5.3.0斜线

本地测试使用WAMP在64位Windows 7的时候我已经收到此错误: 阿帕奇:2.2.11
PHP:5.3.0

UPDATE我已经升级我的PHP版本5.3.1,这已修复错误。

警告:在 Ç解析错误:\瓦帕\ WWW \维基\ lib中\ EXE /../../ LIB/TPL上线/的MonoBook/style.ini在-C 30 : \瓦帕\ WWW \维基\ lib中\ EXE \ css.php线
警告:在 C()提供的foreach参数无效:\瓦帕\ WWW \维基\ lib中\ EXE \ CSS。 php on line

style.ini

; INI to handle loading of the CSS files of the "monobook" template for DokuWiki 
; 
; 
; LICENSE: This file is open source software (OSS) and may be copied under 
;   certain conditions. See COPYING file for details or try to contact 
;   the author(s) of this file in doubt. 
; 
; @license GPLv2 (http://www.gnu.org/licenses/gpl2.html) 
; @author Andreas Haerter <[email protected]> 
; @link http://andreas-haerter.com/projects/dokuwiki-template-monobook 
; @link http://www.dokuwiki.org/template:monobook 
; @link http://www.dokuwiki.org/devel:css#styleini 



; Please see http://www.php.net/manual/en/function.parse-ini-file.php 
; for limitations of the ini format used here 

; Define the stylesheets your template uses here. The second value 
; defines for which output media the style should be loaded. Currently 
; print, screen and rtl are supported. rtl styles are loaded additionally 
; to screen styles if a right-to-left language is selected (eg. hebrew) 
[stylesheets] 

; screen 
; note to myself: don't forget to respect the workaround within "bug49642.php" 
;     when adding new screen styles. 
; load the DokuWiki styles. See <http://j.mp/eq8zSo> why I am doing this. 
[line:30] static/3rd/dokuwiki/_imgdetail.css  = screen 
static/3rd/dokuwiki/_media_popup.css  = screen 
static/3rd/dokuwiki/_media_fullscreen.css = screen 
static/3rd/dokuwiki/_fileuploader.css  = screen 
static/3rd/dokuwiki/_tabs.css    = screen 
static/3rd/dokuwiki/_links.css   = screen 
static/3rd/dokuwiki/_toc.css    = screen 
static/3rd/dokuwiki/_footnotes.css  = screen 
static/3rd/dokuwiki/_search.css   = screen 
static/3rd/dokuwiki/_recent.css   = screen 
static/3rd/dokuwiki/_diff.css    = screen 
static/3rd/dokuwiki/_edit.css    = screen 
static/3rd/dokuwiki/_modal.css   = screen 
static/3rd/dokuwiki/_forms.css   = screen 
static/3rd/dokuwiki/_admin.css   = screen 

; load the most important MediaWiki monobook styles 
static/3rd/monobook/main.css = screen 

; load the specific "monobook for dokuwiki" styles 
static/css/screen.css = screen 
user/screen.css  = screen 

这是css.php的PHP代码加载ini文件:

// load template styles 
$tplstyles = array(); 
if(@file_exists($tplinc.'style.ini')){ 
    $ini = parse_ini_file($tplinc.'style.ini',true); 
    foreach($ini['stylesheets'] as $file => $mode){ 
     $tplstyles[$mode][$tplinc.$file] = $tpldir; 
    } 
} 
+2

上述文件使用PHP/5.2.17-win32解析了我(我的编辑器中实际上第29行的'[line:30]'已经被删除]。 ini文件中的斜杠不是AFAIK特殊字符,并且在密钥中应该是合法的。这是一个简单的ISO-8859-1文件吗?没有UTF搞砸你? – DaveRandom 2012-03-14 10:52:52

+1

PHP 5.3正在解析这个没有probs的文件(在mac上) – clops 2012-03-14 10:55:20

+0

是的,这两个都是正确的,我刚刚在Linux服务器上测试过,它正常工作。它一定是PHP版本的问题,因为一旦我升级到5.3.1,错误就消失了。 – 2012-03-14 13:27:11

回答