小编Ene*_*oma的帖子

忽略返回的第一条记录的SQL命令

我有一个SQL查询,根据日期在博客上显示评论.我想忽略第一个并显示所有其余的东西,这是我无法正确做到的.

到目前为止我的代码是:

SELECT DISTINCT comment_post_ID, comment_date_gmt, comment_content
   FROM $wpdb->comments 
   WHERE comment_post_ID = {$thePostID}
   ORDER BY comment_date_gmt ASC 
   LIMIT 5
Run Code Online (Sandbox Code Playgroud)

mysql sql

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

MySQL连接未关闭时会发生什么?

可能重复:
如果在PHP页面上不连续关闭MySQL连接会发生什么?

如果您忘记有时关闭连接会在一段时间内关闭,自动或将保持打开状态?

$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
$db = mysql_select_db(DB_DATABASE);
.
.
your code
.
.
and you forget to mysql_close($link);
Run Code Online (Sandbox Code Playgroud)

php mysql

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

在同一页面中同时使用Prototype和jQuery的问题

当我使用jquery脚本进行内联窗口和原型来设置菜单时,我遇到了冲突.当我使用其中一个工作正常.但是当我同时使用它们时,只有原型才有效.我读到了一个关于jquery.noconflict但我可以正确使用它.那些是脚本.

这是我的jquery脚本(内联窗口)

<script type="text/javascript">

$(document).ready(function(){

    //When you click on a link with class of poplight and the href starts with a # 
    $('a.poplight[href^=#]').click(function() {
        var popID = $(this).attr('rel'); //Get Popup Name
        var popURL = $(this).attr('href'); //Get Popup href to define size

        //Pull Query & Variables from href URL
        var query= popURL.split('?');
        var dim= query[1].split('&');
        var popWidth = dim[0].split('=')[1]; //Gets the first query string value

        //Fade in the Popup and add close button
        $('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend(''); …
Run Code Online (Sandbox Code Playgroud)

javascript jquery conflict prototypejs

0
推荐指数
1
解决办法
2631
查看次数

正则表达式匹配希腊字符?

我构建了以下正则表达式

preg_match_all('#(autom(.*?)tic|(.*?)anual)#', $str2b, $gears);
Run Code Online (Sandbox Code Playgroud)

但我想改变它以匹配希腊字符.我想要匹配的话???????, ?????????但我不能让它工作.

preg_match_all('#(?????(.*?)?|??????(.*?)??)#', $str2b, $gears);
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

php regex unicode

0
推荐指数
1
解决办法
819
查看次数

修改PHP代码以从文档中提取特定字符串

我使用以下代码从Twitter中提取一些用户名.到目前为止我做的是这样:

    [0] => com/USERNAME/statuses/167362593990778881USERNAME@twitter.
    [1] => com/ANOTHER_USERNAME/statuses/167362593390997506ANOTHER_USERNAME@twitter.
Run Code Online (Sandbox Code Playgroud)

这是我的代码..我怎么才能只提取用户名?

    $file = file_get_contents("http://search.twitter.com/search.rss?q=twitter");
    $file = strip_tags($file);        

    preg_match_all("([a-z0-9!#$%&'*+/=?^_`{|}~-]*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)\b)siU", $file, $matches);

    echo '<pre>';
    print_r($matches);
    echo '</pre>';
Run Code Online (Sandbox Code Playgroud)

我使用simplexml做了这个,但我得到的只是第一个结果

$url="http://search.twitter.com/search.atom?q=hello";
$twitter_xml = simplexml_load_file($url); 

foreach ($twitter_xml->entry->author as $key) {
    $author = $key->{"uri"};

    echo"<li><h5>$author</h5></li>";
}
Run Code Online (Sandbox Code Playgroud)

php regex

-1
推荐指数
1
解决办法
126
查看次数

如何在<head>中移动<title>?

在我的网站上,我对所有页面都有相同的标题.所以我使用include头部的函数.这包括所有<head></head>.

因为它<title>是可变的,取决于页面,我把它放在后面<body>.

我知道这是错的.如何修复此问题并将变量移到<title>标准内<head>

谢谢

html php

-1
推荐指数
1
解决办法
106
查看次数

Google会映射自动填充以限制在特定国家/地区显示的地点吗?

我正确使用谷歌地图自动完成,但我想限制显示到特定国家/地区的所有地方.

我应该对代码做什么修改才能实现?

  function initAutocomplete() {
    autocomplete = new google.maps.places.Autocomplete(
        (document.getElementById('autocomplete')),
        {types: ['geocode']});
  }


  function geolocate() {
    if (navigator.geolocation) {
      navigator.geolocation.getCurrentPosition(function(position) {
        var geolocation = {
          lat: position.coords.latitude,
          lng: position.coords.longitude
        };

        var circle = new google.maps.Circle({
          center: geolocation,
          radius: position.coords.accuracy
        });
        autocomplete.setBounds(circle.getBounds());
      })

;
        }
      }
Run Code Online (Sandbox Code Playgroud)

javascript jquery google-maps

-1
推荐指数
1
解决办法
4579
查看次数

使用正则表达式进行简单的电子邮件验证

可能重复:
验证电子邮件地址的最佳正则表达式是什么?
是否有用于电子邮件地址验证的php库?

在我的注册表格中,用户将添加他的电子邮件,然后收到一封电子邮件以验证他的帐户.但是,我希望有一个简单的电子邮件验证,我想知道以下是否合适.

<?php
$email = "someone@example.com";

if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {

  echo "Valid email address.";
}

else {

  echo "Invalid email address.";
}
?>
Run Code Online (Sandbox Code Playgroud)

php preg-match

-2
推荐指数
2
解决办法
1万
查看次数

Bootstrap carousel仅显示第一项.我在这里错过了什么?

我正在将bootstrap轮播实现到我的页面中,但是我只能看到第一个项目(包含3个部分)而不是其他两个.

在bootply http://www.bootply.com/A465PmKBRm它正在工作,但不在我的网站上.用我正在使用的版本测试它.

我在这里错过了什么?

<div class="row">

                <div id="carousel-content" class="carousel slide" data-ride="carousel">
                  <!-- Indicators -->
                  <ol class="carousel-indicators">
                    <li data-target="#carousel-content" data-slide-to="0" class="active"></li>
                    <li data-target="#carousel-content" data-slide-to="1" class=""></li>
                    <li data-target="#carousel-content" data-slide-to="2" class=""></li>
                  </ol>

                  <!-- Wrapper for slides -->
                  <div class="carousel-inner">
                    <div class="item active">
                                    <!-- SINGLE SERVICE -->
                                    <div class="col-md-4 single-service wow fadeIn animated animated animated" data-wow-offset="10" data-wow-duration="1.5s" style="visibility: visible; -webkit-animation-duration: 1.5s;">
                                        <!-- SERVICE HEADING -->
                                        <h3>text</h3>
                                        <!-- SERVICE DESCRIPTION -->
                                        <p>description</p>
                                    </div>
                                    <!-- /END SINGLE SERVICE -->
                                    <!-- SINGLE SERVICE -->
                                    <div class="col-md-4 …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery twitter-bootstrap

-17
推荐指数
1
解决办法
2143
查看次数