<?php
$host = 'http://google.com';
if($socket =@ fsockopen($host, 80, $errno, $errstr, 30)) {
echo 'online!';
fclose($socket);
} else {
echo 'offline.';
?>
Run Code Online (Sandbox Code Playgroud)
我正在使用上面的程序来获取网站的状态.但我总是得到一个离线消息.代码有什么错误吗?
add_filter('wp_list_pages_excludes', 'gr_wp_list_pages_excludes');
function gr_wp_list_pages_excludes($exclude_array) {
$id_array=$array('22');
$exclude_array=array_merge($id_array, $exclude_array);
return $exclude_array;
}
Run Code Online (Sandbox Code Playgroud)
我是wordpress的新手.上面的代码工作正常.但是我需要传递额外的参数,比如$ mu_cust_arg到函数gr_wp_list_pages_excludes.如何通过apply_filters或任何其他方法使用它?任何帮助表示赞赏.
提前致谢.
我理解\ s用于匹配空格字符,但有时我看到"\\ s"用于preg匹配并且工作正常.例如:
if (preg_match("/\\s/", $myString)) {
// there are spaces
}
if (preg_match("/\s/", $myString)) {
// there are spaces
}
Run Code Online (Sandbox Code Playgroud)
上面两个代码块之间有什么区别吗?
我将mysql数据库中特定div的内容保存为html元素.所以html元素内容包括许多元素,例如:
<div id="div0" class="box" style="z-index: 2; width: 1689px; height: 1013px;">
<img style="margin: 0px; position: relative; display: block; height: 550px; width: 638px; top: 0px; left: 0px;">
</div>
Run Code Online (Sandbox Code Playgroud)
有没有办法减少数据有效存储在mysql数据库中.
比如在保存到db之前要压缩的任何php或javascript函数.