Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 未定义常数的使用_Php_Undefined_Constants - Fatal编程技术网

Php 未定义常数的使用

Php 未定义常数的使用,php,undefined,constants,Php,Undefined,Constants,嗨,我在我的网站上有这个错误 我的网站是WordPress4 我使用post格式 在文章格式中,我创建了这个php,如果页面有引用文章,那么不要从引用文章中加载标题和图像等,只显示引用内容是元框wordpress Notice: Use of undefined constant quote - assumed 'quote' in C:\xampp\htdocs\personal\wp-content\themes\personal\warp\systems\wordpress\layouts

嗨,我在我的网站上有这个错误 我的网站是WordPress4 我使用post格式 在文章格式中,我创建了这个php,如果页面有引用文章,那么不要从引用文章中加载标题和图像等,只显示引用内容是元框wordpress

Notice: Use of undefined constant quote - assumed 'quote' in C:\xampp\htdocs\personal\wp-content\themes\personal\warp\systems\wordpress\layouts\_post.php on line 4

这是下面的_post.php代码

<?php $format = get_post_format(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('group'); ?>>    
<?php
if ($format != quote ) { 
$css_class = "b-box"; 
} else { 
$css_class = "q-box"; 
}

echo "<div class=\"$css_class\">";  
?>
        <?php get_template_part('inc/post-formats'); ?>

        <?php if ($format != quote ) : ?>
        <div class="post-content">
            <div class="blog-img-box">
                <img src="<?php echo catch_that_image() ?>" alt="<?php the_title(); ?>" />
             </div>
    <div class="post-deco blog-icon-box">
            <div class="hex hex-small">
                <i class="fa blog-icon"></i>
                <?php if ( $format != false ) :?><a href="<?php echo get_post_format_link($format); ?>"></a><?php endif; ?>
            </div>
        </div><!--/.post-deco-->
        <h2 class="blog-title">
        <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>
    </h2><!--/.post-title-->
             <div class="blog-details row">
                        <div class="col-md-4"><i class="fa fa-calendar blog-details-icons"></i>
                            <p class="blog-details-icons-txt"><?php the_time('j M, Y'); ?></p>
                        </div>
                        <div class="col-md-4">
                        <a href="<?php comments_link(); ?>">
                        <i class="fa fa-comment blog-details-icons"></i>
                           <p class="blog-details-icons-txt"><?php comments_number( '0', '1', '%' ); ?>&nbsp;Comments</p></a>
                        </div>
                        <div class="col-md-4"><i class="fa fa-eye blog-details-icons"></i>
                            <p class="blog-details-icons-txt"><?php echo getPostViews(get_the_ID()); ?></p>
                        </div>
                        <div class="likes"><i class="fa fa-heart blog-details-icons"></i>
                            <p class="blog-details-icons-txt">18</p>
                        </div>
                    </div>
                    <div class="blog-txt">
            <?php the_excerpt(); ?>
            </div>
            <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><div class="readmore-box"><p class="readmore-txt"><?php _e('Read More','anew'); ?></p></div></a>
        </div><!--/.post-content-->
        <?php endif ?>
    </div><!--/.post-inner-->
</article><!--/.post--> 
请检查并告诉我我做错了什么

谢谢大家!

如果要将引号用作文字字符串第4行,而不是变量名,则必须将其括在单引号或双引号字符“或”中。否则,PHP认为您正在引用一个PHP常量


出于向后兼容性的原因,PHP使用字符串作为文本,但它确实会抛出一个E_NOTICE错误–您正在经历的错误。

验证所有变量是否都有此符号$

正确的变量$test


变量测试不正确

请编辑您的帖子并添加一些。还有,这里和那里的人物?还建议使用大写字母。目前,我很难在心里分析你的第一句话。你能调整你的解决方案,使之适合共享的代码吗?
<?php $format = get_post_format(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('group'); ?>>    
<?php
if ($format != quote ) { 
$css_class = "b-box"; 
} else { 
$css_class = "q-box"; 
}

echo "<div class=\"$css_class\">";  
?>
        <?php get_template_part('inc/post-formats'); ?>

        <?php if ($format != quote ) : ?>
        <div class="post-content">
            <div class="blog-img-box">
                <img src="<?php echo catch_that_image() ?>" alt="<?php the_title(); ?>" />
             </div>
    <div class="post-deco blog-icon-box">
            <div class="hex hex-small">
                <i class="fa blog-icon"></i>
                <?php if ( $format != false ) :?><a href="<?php echo get_post_format_link($format); ?>"></a><?php endif; ?>
            </div>
        </div><!--/.post-deco-->
        <h2 class="blog-title">
        <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>
    </h2><!--/.post-title-->
             <div class="blog-details row">
                        <div class="col-md-4"><i class="fa fa-calendar blog-details-icons"></i>
                            <p class="blog-details-icons-txt"><?php the_time('j M, Y'); ?></p>
                        </div>
                        <div class="col-md-4">
                        <a href="<?php comments_link(); ?>">
                        <i class="fa fa-comment blog-details-icons"></i>
                           <p class="blog-details-icons-txt"><?php comments_number( '0', '1', '%' ); ?>&nbsp;Comments</p></a>
                        </div>
                        <div class="col-md-4"><i class="fa fa-eye blog-details-icons"></i>
                            <p class="blog-details-icons-txt"><?php echo getPostViews(get_the_ID()); ?></p>
                        </div>
                        <div class="likes"><i class="fa fa-heart blog-details-icons"></i>
                            <p class="blog-details-icons-txt">18</p>
                        </div>
                    </div>
                    <div class="blog-txt">
            <?php the_excerpt(); ?>
            </div>
            <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><div class="readmore-box"><p class="readmore-txt"><?php _e('Read More','anew'); ?></p></div></a>
        </div><!--/.post-content-->
        <?php endif ?>
    </div><!--/.post-inner-->
</article><!--/.post-->