我知道如何使用Google API在AJAX中返回图像结果,但我希望能够返回特定查询的图像,然后将其输出到我页面上的HTML中.
例如:
http://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=sausages
返回带有关于关键字香肠的前10个结果的信息和图像的结果.
如何使用PHP中的HTML查询此URL以在我的页面上输出图像的图像和标题.
我在函数顶部使用以下命令返回标题:
$tit = get_the_title();
Run Code Online (Sandbox Code Playgroud)
然后我在这里讨论它:
$json = get_url_contents('http://ajax.googleapis.com/ajax/services/search/images?v=1.0&q='.$tit.'');
Run Code Online (Sandbox Code Playgroud)
但它不承认标题
我创建了一个wordpress查询,我试图排除一个id为1293的帖子.
这是我到目前为止所写的查询:
<?php
$my_query = new WP_Query(array (
'post__not_in' => array(1293),
'post_type' => 'product',
'posts_per_page' => '100'
));
?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
Run Code Online (Sandbox Code Playgroud) 我的数据显示在我的网站上,来自XML Feed.不幸的是,在XML feed中,所有者使用了严重的口音:`而不是叛逆:'
我正在使用以下javascript尝试用撇号替换重音符号,但它仅适用于内容中的第一个重音符号.如何调整代码以使其影响p标签内的所有重音符号.
<script type="text/javascript">
$("p").each(function() {
var text = $(this).text();
text = text.replace("`", "'");
$(this).text(text);
});
</script>
Run Code Online (Sandbox Code Playgroud)