小编Pla*_*der的帖子

输出被多次提交

目前我正在使用simple_html_dom来搜索网站视图,以查看我正在抓取的网站,一切都回来了,除了它继续为每一个帖子添加相同的内容它查看 .. 查看此处查看演示

$page = (isset($_GET['p'])&&$_GET['p']!=0) ? (int) $_GET['p'] : '';  
$html = file_get_html('http://screenrant.com/movie-news/'.$page);

foreach($html->find('#site-top > div.site-wrapper > div.top-content > article > section > ul > li > div.info > h2 > a') as $element)
{
    print '<br><br>';
    echo $url = ''.$element->href;
    $html2 = file_get_html($url);

    $image = $html2->find('meta[property=og:image]',0);
    $news['image'] = $image->content;
    #print '<br><br>';

    // Ending The Featured Image

    #site-top > div.site-wrapper > div.top-content > article > section > ul > li:nth-child(2)

    $title = $html2->find('#site-top > …
Run Code Online (Sandbox Code Playgroud)

php

7
推荐指数
1
解决办法
57
查看次数

在 AJAX 页面上刷新 google adsense

我知道直接刷新广告违反了Google adsenseTOS,但我想知道是否可以在主题网站上使用JUST 在 30 秒左右后刷新广告?java scriptAJAX

目前,如果我在我的页面上展示广告,它们将消失,因为 Google 每页限制 3 个广告,并且因为我ajax基本上是用来防止我的页面刷新我将假设不可能在上面展示Google Adsense广告我的网站?

javascript ajax jquery

5
推荐指数
1
解决办法
6736
查看次数

将字符串保存到数据库

我正在尝试保存一个字符串,这个字符串只是在一个名为here的$id = "27491";数据库表中users,这个字段user id在这里调用,这是我目前所尝试的但是它不起作用...

mysqli_query($DB,"INSERT INTO `users` SET `id` = '".$id."'");
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

编辑:内容只是没有进入数据库,之前的问题只是一个错字.

也不适用于我的$title字符串.

mysqli_query($DB,"INSERT INTO `users` SET `title` = '".mysqli_real_escape_string($DB,$title)."'");
Run Code Online (Sandbox Code Playgroud)

php mysql

4
推荐指数
2
解决办法
109
查看次数

使我网站上的每个href都有不同的颜色

目前,我使用静态CSS使用看起来像下面显示的代码的东西.

#main-content > article.mh-loop-item.clearfix.post-95.post.type-post.status-publish.format-standard.has-post-thumbnail.hentry.category-singles.tag-kxngg-jxnes-italy > div > header > h3 > a {
color: blue;
}
#main-content > article.mh-loop-item.clearfix.post-93.post.type-post.status-publish.format-standard.has-post-thumbnail.hentry.category-singles.tag-aquil-eddie-guerrero > div > header > h3 > a {
color: red;
}
Run Code Online (Sandbox Code Playgroud)

并且对于每个帖子ID,它会为那些歌曲标题生成不同的颜色,因为我试图用Javascript做一些更高级的东西,或者当有某个href与某个类时,它生成一个随机的东西该链接的颜色显示为.

html javascript css

3
推荐指数
1
解决办法
85
查看次数

我怎样才能从中获取URL?

我为我的网站收到了很多DMCA删除电子邮件,我正在尝试自动从我的网站删除这些曲目的过程.

所有的电子邮件看起来都与此类似.

http://example.com/title-to-post.html title - to post
http://example.com/title-of-post.html title - of post
http://example.com/some-song-artist-some-song-name.html some song artist - some song name
Run Code Online (Sandbox Code Playgroud)

但是它们中有很多,我只想返回其中每个部分的URL部分,例如下面的例子.

http://example.com/title-to-post.html
http://example.com/title-of-post.html
http://example.com/some-song-artist-some-song-name.html
Run Code Online (Sandbox Code Playgroud)

编辑:我将这些文件存储到txt文件,然后使用标准代码调用它们.

$urls = file_get_contents( "oururls.txt" );
$data = explode(",", $urls);
    foreach ($data as $item) {
    echo "$item";
    echo '<br>';
}
Run Code Online (Sandbox Code Playgroud)

没有什么真正的花哨,它如何回归标题,我只想要网址.

html php

3
推荐指数
1
解决办法
46
查看次数

标签 统计

php ×3

html ×2

javascript ×2

ajax ×1

css ×1

jquery ×1

mysql ×1