PHP注意:使用未定义的常量php - 假设' php'

时间:2017-12-08 02:56:38

标签: php wordpress

只是编辑了一个网站,我正在努力将订阅表单包含在footer.php而不仅仅是主页中。我在本地服务器上进行了更改,然后将其移动到我的实时环境(dev子文件夹)。我没有在我的localhost上看到任何错误,但在开发站点上它显示以下错误:

  

PHP注意:使用未定义的常量php - 假设' php'在第1行的/home/website-name/public_html/uk-en/dev/wp-content/themes/theme-name/footer.php

第1行的唯一内容是打开php标记,请参阅以下footer.php文件中的代码

<?php?>
</div><!-- #main -->
<footer id="colophon" class="site-footer" role="contentinfo">
    <div class="subscribe-form">
        ‪<p>SIGN UP TO OUR EMAIL NEWSLETTER FOR NEWS, OFFERS & EXCITING COMPETITIONS.<p>
    <div class="contact-7-subscribe">           <?php echo do_shortcode( '[contact-form-7 id="4563" title="Newsletter"]' ); ?>      </div>
    </div>
    <div class="site-info">

        <div class="socialmedia">
            <a href="https://www.facebook.com/pg/page-name/" target="_blank" class="facebook"></a>
            <a href="https://twitter.com/page-name?lang=en" target="_blank" class="twitter"></a>
            <a href="https://www.instagram.com/page-name/" target="_blank" class="youtube"></a>
        </div>
        <div class="payment_cards">
            <img src="<?=site_url();?>/wp-content/uploads/2017/05/payment_cards.png" alt="payments cards"/>
        </div>
        <?php /* Widgetized sidebar */ if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footerwidget') ) : ?><?php endif; ?>
    </div><!-- .site-info -->
</footer><!-- #colophon -->
</div><!-- #page -->
<?php wp_footer(); ?>
<?php /* if(get_the_ID() == 5) { ?>
<script type="text/javascript" 
src="//s3.amazonaws.com/downloads.mailchimp.com/js/signup-
forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false">
</script><script type="text/javascript">require(["mojo/signup-
forms/Loader"], function(L) { L.start({"baseUrl":"mc.us10.list-
manage.com","uuid":"37710aefba71598269bda7def","lid":"4385b1c355"}) })
</script>
<?php } */ ?>
<!--Start of Zopim Live Chat Script-->
<script type="text/javascript">
window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s=
d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set.
_.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute("charset","utf-8");
$.src="//v2.zopim.com/?34qd49wmFaK3NsxoUst4PCSk4gaXUQVe";z.t=+new Date;$.
type="text/javascript";e.parentNode.insertBefore($,e)})(document,"script");
</script>
<!--End of Zopim Live Chat Script--> 
<?php /*?><script type="text/javascript" 
src="//s3.amazonaws.com/downloads.mailchimp.com/js/signup-
forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false">
</script><script type="text/javascript">require(["mojo/signup-
forms/Loader"], function(L) { L.start({"baseUrl":"mc.us10.list-
manage.com","uuid":"37710aefba71598269bda7def","lid":"4385b1c355"}) })
</script><?php */?>
</body>
</html>

我可以关闭通知显示但是我想得到正确的解决方案而不是掩饰

任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:3)

php开始标记的基本语法是<?php[whitespace]而不只是<?php,请参阅此处http://php.net/manual/en/language.basic-syntax.phptags.php#118827。 所以正确的语法是在php开始和结束标记<?php ?>

之间添加一个空格