我正在尝试为以下情况获得正确的语法?
SELECT *
FROM wp_posts AS p
WHERE post_type = 'post'
AND post_status = 'publish'
AND ID <> 5616,1095,1357,271,2784,902
ORDER BY post_title DESC
Run Code Online (Sandbox Code Playgroud) 我有问题弄清楚为什么jquery字符串计数器不会显示预期的结果.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
var count = $('h1').length;
alert(count);
</script>
</head>
<body>
<h1>some text</h1>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
结果应该是这个例子9,但我得到0
我正在尝试使用php mvc而且我遇到了以下问题.我的请求和路由器类非常简单,我想扩展主题,可以处理来自子文件夹的控制器调用,并且控制器类函数应该能够获取url变量发送它抛出get和post.
我的路由器看起来如下
class Router{
public static function route(Request $request){
$controller = $request->getController().'Controller';
$method = $request->getMethod();
$args = $request->getArgs();
$controllerFile = __SITE_PATH.'/controllers/'.$controller.'.php';
if(is_readable($controllerFile)){
require_once $controllerFile;
$controller = new $controller;
if(!empty($args)){
call_user_func_array(array($controller,$method),$args);
}else{
call_user_func(array($controller,$method));
}
return;
}
throw new Exception('404 - '.$request->getController().'--Controller not found');
}
}
Run Code Online (Sandbox Code Playgroud)
和请求类
private $_controller;
private $_method;
private $_args;
public function __construct(){
$parts = explode('/',$_SERVER['REQUEST_URI']);
$this->_controller = ($c = array_shift($parts))? $c: 'index';
$this->_method = ($c = array_shift($parts))? $c: 'index';
$this->_args = (isset($parts[0])) ? $parts : array();
} …Run Code Online (Sandbox Code Playgroud) 是否可以使用jqueries这个形式的每个循环来解散超链接?
$(document).ready(function() {
var toExclude =['http://www.google.com', 'http://example'];
$.each(toExclude, function(key, value) {
$("a[href='+value+']").replaceWith(function(){
var matches = value.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i);
var domain = matches && matches[1];
return domain;
});
});
});
Run Code Online (Sandbox Code Playgroud) 我有以下字符串+ Example + Test + Test2并使用preg_replace我想得到以下结果+Example +Test +Test2
我一直在尝试使用以下代码
preg_replace("/\s*([\+])\s*/", "$1", $string)
Run Code Online (Sandbox Code Playgroud)
但这一个正在回归
+Example+Test+Test2
Run Code Online (Sandbox Code Playgroud)