技术领域

<?php
function password_strength($password){
  $strength = 0;
  
  // 小写字母
  if(preg_match("/([a-z]+)/", $password)) $strength++;
  
  // 大写字母
  if(preg_match("/([A-Z]+)/", $password))  $strength++;
  
  // 数字
  if(preg_match("/([0-9]+)/", $password))  $strength++;
  
  // 非任意(文字和数字)字母和下滑线的字符
  if(preg_match("/(\W+)/", $password))  $strength++;
  
  // 密码的长度
  if (strlen($password) < 7) $strength--;
  else $strength++;

  switch($strength) {
    case 0:
    case 1:
      $text = '密码强度太弱';
      break;
    case 2:
      $text = '密码强度弱';
      break;
    case 3:
      $text = '密码强度高';
      break;
    case 4:
    case 5:
      $text = '密码强度很高';
      break;
  }
  
  return $text;
}

echo password_strength('123aZ456*'); //密码强度很高
?>
简单的笔记一下
select id,tags,(if(locate('人类',tags),2,0)+if(locate('暴力',tags),2,0)+if(locate('美学',tags),2,0)+if(locate('生物学',tags),2,0)+if(locate('机关枪',tags),2,0)) as zh from details order by zh desc
Generic Reset CSS
Esse com certeza é o mais conhecido e utilizado pelos desenvolvedores:

* {
padding: 0;
margin: 0;
border: 0;
}


Ateneu Popular CSS Reset
CSS inicial sugerido pelo site Ateneu Popular:

html, body, div, span, applet, object, iframe, h1, h2, h3,
h4, h5, h6, p, blockquote, pre, a, abbr, acronym,
address, big, cite, code, del, dfn, em, font, img, ins,
kbd, q, s, samp, small, strike, strong, sub, sup, tt,
var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
:focus { outline: 0;}
a, a:link, a:visited, a:hover, a:active{text-decoration:none}
table { border-collapse: separate;border-spacing: 0;}
th, td {text-align: left; font-weight: normal;}
img, iframe {border: none; text-decoration:none;}
ol, ul {list-style: none;}
input, textarea, select, button {font-size: 100%;font-family: inherit;}
select {margin: inherit;}
hr {margin: 0;padding: 0;border: 0;color: #000;background-color: #000;height: 1px}


Chris Poteet's Reset CSS
Técnica sugerida por Chris Poteet's para Reset CSS:

* {
vertical-align: baseline;
font-family: inherit;
font-style: inherit;
font-size: 100%;
border: none;
padding: 0;
margin: 0;
}
body {
padding: 5px;
}
h1, h2, h3, h4, h5, h6, p, pre, blockquote, form, ul, ol, dl {
margin: 20px 0;
}
li, dd, blockquote {
margin-left: 40px;
}
table {
border-collapse: collapse;
border-spacing: 0;
}


Yahoo's CSS Reset
Técnica de Reset CSS proposta pelo Yahoo:

body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,
form,fieldset,input,textarea,p,blockquote,th,td {
padding: 0;
margin: 0;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
fieldset,img {
border: 0;
}
address,caption,cite,code,dfn,em,strong,th,var {
font-weight: normal;
font-style: normal;
}
ol,ul {
list-style: none;
}
caption,th {
text-align: left;
}
h1,h2,h3,h4,h5,h6 {
font-weight: normal;
font-size: 100%;
}
q:before,q:after {
content:'';
}
abbr,acronym { border: 0;
}


Eric Meyer Reset CSS
Esse com certeza deve ser o mais utilizado entre os desenvolvedores, proposto por Eric Meyer, é o que eu utilizo atualmente:

html, body, div, span, applet, object, iframe, table, caption,
tbody, tfoot, thead, tr, th, td, del, dfn, em, font, img, ins,
kbd, q, s, samp, small, strike, strong, sub, sup, tt, var,
h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr,
acronym, address, big, cite, code, dl, dt, dd, ol, ul, li,
fieldset, form, label, legend {
vertical-align: baseline;
font-family: inherit;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
outline: 0;
padding: 0;
margin: 0;
border: 0;
}
:focus {
outline: 0;
}
body {
background: white;
line-height: 1;
color: black;
}
ol, ul {
list-style: none;
}
table {
border-collapse: separate;
border-spacing: 0;
}
caption, th, td {
font-weight: normal;
text-align: left;
}
blockquote:before, blockquote:after, q:before, q:after {
content: "";
}
blockquote, q {
quotes: "" "";
}


Tantek Celik Reset CSS
Técnica de Reset CSS proposta por Tantek Celik:

:link,:visited { text-decoration:none }
ul,ol { list-style:none }
h1,h2,h3,h4,h5,h6,pre,code { font-size:1em; }
ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,body,html,p,blockquote,fieldset,input
{ margin:0; padding:0 }
a img,:link img,:visited img { border:none }
address { font-style:normal }


Christian Montoya Reset CSS
Técnica sugeria por Christian Montoya:

html, body, form, fieldset {
margin: 0;
padding: 0;
font: 100%/120% Verdana, Arial, Helvetica, sans-serif;
}
h1, h2, h3, h4, h5, h6, p, pre,
blockquote, ul, ol, dl, address {
margin: 1em 0;
padding: 0;
}
li, dd, blockquote {
margin-left: 1em;
}
form label {
cursor: pointer;
}
fieldset {
border: none;
}
input, select, textarea {
font-size: 100%;
font-family: inherit;
}


Rudeworks Reset CSS
Técinca de Reset CSS proposta por Rudeworks:

* {
margin: 0;
padding: 0;
border: none;
}
html {
font: 5% "Lucida Grande", Lucida, Verdana, sans-serif;
text-shadow: #000 0px 0px 0px;
}
ul {
list-style: none;
list-style-type: none;
}
h1, h2, h3, h4, h5, h6, p, pre,
blockquote, ul, ol, dl, address {
font-weight: normal;
margin: 0 0 1em 0;
}
cite, em, dfn {
font-style: italic;
}
sup {
position: relative;
bottom: 3em;
vertical-align: baseline;
}
sub {
position: relative;
bottom: -2em;
vertical-align: baseline;
}
li, dd, blockquote {
margin-left: 1em;
}
code, kbd, samp, pre, tt, var, input[type='text'], textarea {
font-size: 100%;
font-family: monaco, "Lucida Console", courier, mono-space;
}
del {
text-decoration: line-through;
}
ins, dfn {
border-bottom: 1px solid #ccc;
}
small, sup, sub {
font-size: 85%;
}
abbr, acronym {
text-transform: uppercase;
font-size: 85%;
letter-spacing: .1em;
border-bottom-style: dotted;
border-bottom-width: 1px;
}
a abbr, a acronym {
border: none;
}
sup {
vertical-align: super;
}
sub {
vertical-align: sub;
}
h1 {
font-size: 2em;
}
h2 {
font-size: 8em;
}
h3 {
font-size: 6em;
}
h4 {
font-size: 4em;
}
h5 {
font-size: 2em;
}
h6 {
font-size: 1em;
}
a, a:link, a:visited, a:hover, a:active {
outline: 0;
text-decoration: none;
}
a img {
border: none;
text-decoration: none;
}
img {
border: none;
text-decoration: none;
}
label, button {
cursor: pointer;
}
input:focus, select:focus, textarea:focus {
background-color: #FFF;
}
fieldset {
border: none;
}
.clear {
clear: both;
}
.float-left {
float: left;
}
.float-right {
float: right;
}
body {
text-align: center;
}
#wrapper {
margin: 0 auto;
text-align: left;
}


Anieto2K Reset CSS
Técnica de Reset CSS proposta por Andrés Nieto:

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p,
blockquote, pre, a, abbr, acronym, address, big,
cite, code, del, dfn, em, font, img,
ins, kbd, q, s, samp, small, strike,
strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
center, u, b, i {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-weight: normal;
font-style: normal;
font-size: 100%;
font-family: inherit;
vertical-align: baseline
}
body {
line-height: 1
}
:focus {
outline: 0
}
ol, ul {
list-style: none
}
table {
border-collapse: collapse;
border-spacing: 0
}
blockquote:before, blockquote:after, q:before, q:after {
content: ""
}
blockquote, q {
quotes: "" ""
}
input, textarea {
margin: 0;
padding: 0
}
hr {
margin: 0;
padding: 0;
border: 0;
color: #000;
background-color: #000;
height: 1px
}


CSSLab CSS Reset
Técnica de CSS Reset proposta pelo site CSSLab:

html, body, div, span, applet, object, iframe, h1, h2, h3,
h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address,
big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li,
fieldset, form, label, legend, table, caption, tbody, tfoot,
thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
:focus {
outline: 0;
}
table {
border-collapse: separate;
border-spacing: 0;
}
caption, th, td {
text-align: left;
font-weight: normal;
}
a img, iframe {
border: none;
}
ol, ul {
list-style: none;
}
input, textarea, select, button {
font-size: 100%;
font-family: inherit;
}
select {
margin: inherit;
}
/* Fixes incorrect placement of numbers in ol's in IE6/7 */
ol { margin-left:2em; }
/* == clearfix == */
.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.clearfix {display: inline-block;}
* html .clearfix {height: 1%;}
.clearfix {display: block;}
做前端开发的同学们,也许比较能体会到脚本错误的痛苦,脚本错误产生有很多种原因,从大的方向来分,分为两种,一种是人为的,一种是浏览器加载不全导致。

对于第二种情况,暂时来说是无能为力,至于人为的脚本错误,很多也是不经意所产生的,同样是因为不经意,所以你要找到原因也不容易,在这里给各位同学说说我平时是怎么调试的。


<script>
// 这是一个存在语法错误的JS函数
function test(){
  window.location.href = a;
}

// 自定义的调试函数
function debug(message, url, line){
  alert(
    "Error:" + message +
    "\nUrl:" + url +
    "\nLine:" + line
  );
  return false;
}

// 触发脚本错误
window.onload = test;

// 输出调试信息
window.onerror = debug;
</script>


得到的结果是
引用
Error:a is not defined
Url:file:///C:/Users/hdj/Desktop/html/jserror.html
Line:13
引用
官方给出的参考解决方法应该是首选检查的:
1、UCenter 应用 ID 需要和 UCenter 后台的 ID 一致;
2、UCenter 通信密钥需要和 UCenter 后台的通信密钥一致;
3、UCenter 访问地址查看是否是正确的地址;
4、UCenter IP 地址查看是否是 UCenter 所在的 MySQL 服务器的 IP 地址。


一一检查,并没有发现以上所提到的情况,这问题困扰了我相当长的一段时间了,我决定不解决誓不摆休。

后来按照http://www.discuz.net/thread-1388614-1-1.html上面的方法,顺藤摸瓜,找到了真正的原因。

原来是php5.3.x以后对set_magic_quotes_runtime函数默认不支持导致的问题。

//解决办法:找到api/uc.php
第32号:set_magic_quotes_runtime(0);
改为:@set_magic_quotes_runtime(0);
分页: 1/48 第一页 1 2 3 4 5 6 7 8 9 10 下页 最后页 [ 显示模式: 摘要 | 列表 ]