查询localhost中的工作,但不是实时查询

时间:2017-11-16 07:56:26

标签: php wordpress iframe localhost live

我需要制作iframe网址,例如:

<hibernate-configuration>

<session-factory>

    <!-- Database connection settings -->
    <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>

    <property name="connection.url">jdbc:oracle:localhos</property>
    <property name="connection.username">username</property>
    <property name="connection.password">passowrd123</property>

    <!-- JDBC connection pool (use the built-in) -->
    <property name="connection.pool_size">2</property>

    <!-- SQL dialect -->
    <property name="dialect">org.hibernate.dialect.Oracle12cDialect</property>
    <!-- Disable the second-level cache -->
    <property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
    <!-- Echo all executed SQL to stdout -->
    <property name="show_sql">false</property>

</session-factory>

</hibernate-configuration>

我正在使用MAMP来运行我的本地开发环境,我得到它应该是这样的工作,当查询字符串等于桌面时,它显示3个帖子,当移动时,只有一个帖子。现在问题是,当sysadmin更新pre-live env时,他可以从日志中看到这个错误:

https://url.com/category/{category_name)/t=desktop || /t=mobile.

single-iframe.php完整代码:https://pastebin.com/MBC6thDW

当我试图去测试网址时,我要么得到错误500,要么打印出带有查询功能的标题。

我正在使用PhpStorm IDE,它在我的代码中没有显示任何错误,我在这里缺少什么?

2 个答案:

答案 0 :(得分:2)

这是因为短标签。 在使用“&lt;?”的localhost环境中已启用,在您的开发服务器中它未启用。这是唯一的原因。

http://php.net/manual/en/language.basic-syntax.phptags.php

所以,只需替换“&lt;?”使用“&lt;?php”,它会正常工作。

答案 1 :(得分:1)

试试此代码

https://pastebin.com/7ubTY2A4

<?php
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="description" content="<?php bloginfo('description'); ?>">
    <?php
    if(get_field('fav_icon', 'option') != ''){
        $favId = get_field('fav_icon', 'option');
        $favDetails = wp_get_attachment_image_src($favId, 'full');
    }
    ?>
    <?php if(!empty($favDetails)): ?>
      <link rel="shortcut icon" href="<?php echo $favDetails[0]; ?>">
    <?php endif;?>




    <title><?php wp_title();?></title>


    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">


    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <?php wp_head(); ?>
    <!--[if (lt IE 9)&(!IEMobile)]>
    <link rel="stylesheet" type="text/css" href="enhanced.css" />
    <link rel="stylesheet" type="text/css" href="iframe.css" />
    <![endif]-->
    <?php
    if(is_front_page()){
        $info = get_bloginfo('description');

        echo '<meta name="og:description" content="'.$info.'">';
        echo '<meta name="og:title" content="Website">';
    }
    ?>
    <style>
        .main-header--frame {
            background-color: #a40057;
            margin-bottom: -40px;
        }
        .main-header--frame .categoryTitle {
            display: inline-block;
            padding-top: 19px;
            padding-left: 10px;
            color: #ffffff;
        }

        .main-header.main-header--frame .container {
            max-width: 1200px;
            background-color: transparent;
        }

    </style>

</head>
<body>
<header class="main-header main-header--frame">
    <nav>
        <div class="container">
            <div class="navbar-header">
                <a href="https://stiil.ee" class="navbar-brand">
                    <img src="logo" alt="logo"
                         class="img-responsive">
                </a>
                <h1 class="categoryTitle">Description</h1>
            </div>
        </div>
    </nav>
</header>
<main class="main-content main-content-inner valitud-content-inner">
    <div class="container">
            <?php
            $queried_object = get_queried_object();
            $taxChilds = get_terms( array(
                    'taxonomy' => 'category',
                    'hide_empty' => true,
                    'child_of' => $queried_object->term_id
            ) ); ?>

            <?php if(isset($_GET) && $_GET['t'] == 'desktop'): ?>
              <div class="category-wrap">
                            <?php
                            $queried_object = get_queried_object();
                            $count =0; 
                            foreach($taxChilds as $taxChild): ?>
                                <?php
                                $args = array(
                                        'post_type'=> 'post',
                                        'cat' => $taxChild->slug,
                                        'posts_per_page' => '1',
                                        'orderby' => 'rand',

                                        'tax_query' => array(
                                                array(
                                                        'taxonomy' => 'category',
                                                        'field'    => 'term_id',
                                                        'hide_empty' => false,
                                                        'terms'    =>  $taxChild->term_id,
                                                ),
                                        )
                                );
                                query_posts($args); if(have_posts()):
                                    while(have_posts()): the_post(); ?>
                                        <div class="col-md-4 all itemz <?php echo $taxChild->slug; ?>" data-cat="<?php echo $taxChild->slug; ?>">
                                            <div class="item-wrap">
                                                <a href="<?php the_permalink();?>"><?php the_post_thumbnail('size-370x416');
                                                                                $sponsored = get_field('is_sponsored_content');
                                                                                if($sponsored){
                                                                                    echo '<div class="sponsored-text">Ad</div>';
                                                                                };
                                                                                ?></a>
                                                <div class="overlay">
                                                    <div class="notify">
                                                        <a href="<?php the_permalink(); ?>"><img src="<?php echo get_post_cat_img_src();?>" alt=""></a>
                                                    </div>
                                                    <h2  class="categoryTitle"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
                                                </div>
                                            </div>
                                        </div>
                                    <?php endwhile; 

                                endif; wp_reset_query();?>
                                <?php
                                if ($count == 2) {
                                    break;
                                }
                                ?>
                                <?php $count++; endforeach;?>
              </div>
            <?php endif; ?>

            <?php if(isset($_GET) && $_GET['t'] == 'mobile'): ?>
              <div class="category-wrap">
                            <?php
                            $queried_object = get_queried_object();
                            $count =0;  foreach($taxChilds as $taxChild): ?>
                                <?php
                                $args = array(
                                        'post_type'=> 'post',
                                        'cat' => $taxChild->slug,
                                        'posts_per_page' => '1',
                                        'orderby' => 'rand',

                                        'tax_query' => array(
                                                array(
                                                        'taxonomy' => 'category',
                                                        'field'    => 'term_id',
                                                        'hide_empty' => false,
                                                        'terms'    =>  $taxChild->term_id,
                                                ),
                                        )
                                );
                                query_posts($args); 
                                if(have_posts()): 
                                    while(have_posts()): the_post(); ?>
                                <div class="col-md-4 all itemz <?php echo $taxChild->slug; ?>" data-cat="<?php echo $taxChild->slug; ?>">
                                    <div class="item-wrap">
                                        <a href="<?php the_permalink();?>"><?php the_post_thumbnail('size-370x416');
                                                                        $sponsored = get_field('is_sponsored_content');
                                                                        if($sponsored){
                                                                            echo '<div class="sponsored-text">SISUTURUNDUS</div>';
                                                                        };
                                                                        ?></a>
                                        <div class="overlay">
                                            <div class="notify">
                                                <a href="<?php the_permalink(); ?>"><img src="<?php echo get_post_cat_img_src();?>" alt=""></a>
                                            </div>
                                            <h2  class="categoryTitle"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
                                        </div>
                                    </div>
                                </div>
                                <?php endwhile; 
                                endif; wp_reset_query();?>
                                <?php
                                if ($count == 0) {
                                    break;
                                }
                                ?>
                                <?php $count++; endforeach;?>
              </div>
            <?php endif; ?>

    </div>
</main>
</body>

<!--main-content ends-->
<?php wp_footer(); ?>