我得到Parse错误:语法错误,意外':'在PHP页面

时间:2015-12-29 00:12:15

标签: php wordpress

我对PHP并不太熟悉,而且我正在尝试设置wordpress页面。

我有类似的功能;

public static function autoload() {
        $path_ = GMEDIA_ABSPATH . '/admin/class.processor.';
        $page = !isset($_GET['page'])?: $_GET['page'];
        switch($page) {
            case 'GrandMedia':
                include_once($path_ . 'library.php');
            break;
            case 'GrandMedia_AddMedia':
                include_once($path_ . 'addmedia.php');
            break;
            case 'GrandMedia_Terms':
                include_once($path_ . 'terms.php');
            break;
            case 'GrandMedia_Galleries':
                include_once($path_ . 'galleries.php');
            break;
            case 'GrandMedia_Modules':
                include_once($path_ . 'modules.php');
            break;
            case 'GrandMedia_Settings':
                include_once($path_ . 'settings.php');
            break;
            case 'GrandMedia_WordpressLibrary':
                include_once($path_ . 'wpmedia.php');
            break;
            default:
                global $gmProcessor;
                $gmProcessor = new GmediaProcessor();
            break;
        }
    }

并且在第3行(是整个代码中的第144行)我得到了这个;

解析错误:语法错误,意外':'在第144行的/vhosts/karasinek.biz/http/wp-content/plugins/grand-media/admin/class.processor.php

你能帮我解决一下吗?

2 个答案:

答案 0 :(得分:2)

您的三元运算符写得不好

尝试$(document).ready(function(){ $('#divToAnimate').velocity( { rotateX: "+=0", rotateY: "+=360", height: '+=50px', width: '+=100px' }, { duration:4000, loop:false, easing:'linear' }); });

答案 1 :(得分:1)

以下这句话我认为是错误的。


#!/bin/sh

for family in $*; do
 for url in $( {
 for agent in \
 'Mozilla/5.0 (X11; Linux i686; rv:6.0) Gecko/20100101 Firefox/6.0' \
 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; de-at) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1' \
 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 7.1; Trident/5.0)' ;
 do
 curl -A "$agent" -s "http://fonts.googleapis.com/css?family=$family" | \
 grep -oE 'http://[A-Za-z0-9/._-]+'; \
 done } | sort -u ) ;
 do
 extn=${url##*.} ;
 file=$(echo "$family"| tr +[:upper:] _[:lower:]);
 echo $url $file.$extn;
 curl -s "$url" -o "$file.$extn";
 done
done

如果这个条件证明是真的,则没有任何设置(即:如果得到[page] == false)

重写为:

$page = !isset($_GET['page']) ? : $_GET['page'];