如何用PHP编写版权?

时间:2015-09-14 21:59:15

标签: php

我正在尝试帮助朋友提供自己的WordPress。问题是,我几乎完全不熟悉php的工作方式。我没有写这段代码,但由于我对html和css有基本的想法,我试图修复它但仍然没有成功。
结果是:; 。版权所有©2015 AABB。版权所有。
但我想:版权所有©2015 AABB。保留所有权利。

  1. 我找不到如何删除“;。 “
  2. 如果我删除:

    Copyright ©
    <?php echo date("Y")." "; ?>
    <?php bloginfo('name')." "; ?>.
    All Rights Reserved.
    

    页脚上不会显示任何版权。

  3. 代码如下:

    <?php
    /**
     * The template for displaying the footer.
     *
     * @package WordPress
     * @subpackage Perfekto
     * @since Perfekto 1.0
         */
        ?>
            </div><!-- end .pad_container -->
    
            <div class="pagination-bg"></div>
            <div class="pagination-bottom"></div>
        <div id="footer">
    
                <div id="foot-full">
    
                    <?php get_sidebar('footerfull');?>
    
                </div><!-- end #footfull -->
    
    
                <div id="foot-full2">
    
                    <?php get_sidebar('footerfull2');?>
    
                </div><!-- end #foot-full2 -->
    
                <div id="foot-col1">
                    <?php get_sidebar('footer1');?>
                </div><!-- end #foot-col1 -->
                <div id="foot-col2">
                    <?php get_sidebar('footer2');?>
                </div><!-- end #foot-col2 -->
                <div id="foot-col3">
                    <?php get_sidebar('footer3');?>
                </div><!-- end #foot-col3 -->
                <div class="clear"></div>
    
            </div><!-- end #footer -->  
            <div id="footer-copyright">
                <div id="copyright">
    <?php /* $foot= stripslashes(get_option('templatesquare_footer')) */ ?>
                    <?php /* if($foot==""){ */?>
                    <?php /* _e('Copyright', 'templatesquare'); */ ?> <!-- &copy -->
                        <?php /* bloginfo( 'name' ); */ ?></a>;
                    <?php
                    /*
                     global $wpdb;
    
                    $post_datetimes = $wpdb->get_results("SELECT YEAR(min(post_date_gmt)) AS firstyear, YEAR(max(post_date_gmt)) AS lastyear FROM $wpdb->posts WHERE post_date_gmt > 1970");
                    if ($post_datetimes) {
                        $firstpost_year = $post_datetimes[0]->firstyear;
                        $lastpost_year = $post_datetimes[0]->lastyear;
                        $copyright = $firstpost_year;
                        if($firstpost_year != $lastpost_year) {
                            $copyright .= '-'. $lastpost_year;
                        }
                        $copyright .= ' ';
    
    
    
    
    
                echo '<a href="'.home_url( '/').'">'.get_bloginfo('name') .'</a>';
                    }
                    */
                ?>. <?php /* _e('All rights reserved.', 'templatesquare'); */ ?>
    
                    <?php /* }else{ */ ?>
                    <?php /* echo $foot; */ ?>
                    <?php /* } */ ?>
    
    
    Copyright &copy;
    <?php echo date("Y")." "; ?>
    <?php bloginfo('name')." "; ?>.
    All Rights Reserved.    
    
    
                </div>
                <div id="footermenu">
    
                <?php wp_nav_menu( array(
                      'container'       => 'ul', 
                      'menu_class'      => '',
                      'menu_id'         => '', 
                      'depth'           => 1,
                      'sort_column'    => 'menu_order',
                      'theme_location' => 'footmenu' 
                      )); 
                ?>
                </div>
            </div><!-- end #footer-copyright -->
        </div><!-- end #container -->
    </div><!-- end #frame -->
    <script type="text/javascript">
    
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-31480559-1']);
      _gaq.push(['_trackPageview']);
    
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
    
    </script>
        <script type="text/javascript"> Cufon.now();</script> <!-- to fix cufon problems in IE browser -->
        <?php
    
            wp_footer();
        ?>
        <?php $google = stripslashes(get_option('templatesquare_google'));?>
        <?php if($google=="false"){?>
        <?php }else{?>
        <?php echo $google; ?>
        <?php } ?>
    
    </body>
    </html>
    

3 个答案:

答案 0 :(得分:0)

你有一个尾随&#39 ;;&#39;和&#39;。&#39;。

罪犯是&#39 ;;&#39;在您的标签旁边的bloginfo(&#39;名称&#39;) - 第46行

和&#39;。&#39;在您注释掉之前_e(&#39;保留所有权利...... - 第68行

答案 1 :(得分:0)

你到处都有随机标点符号,这导致了这个问题。

<?php /* bloginfo( 'name' ); */ ?></a>;
                                      ^----here

?>. <?php /* _e('All rights reserved.', 'templatesquare'); */ ?>
  ^----and here

答案 2 :(得分:-2)

© <?php
    $copyYear = 2008; // Set your website start date
    $curYear = date('Y'); // Keeps the second year updated
      echo $copyYear . (($copyYear != $curYear) ? '-' . $curYear : '');
  ?> Copyright

所有这些代码都有效