php å®ç°é¡µé¢è·³è½¬çåç§æ¹å¼
程序员文章站
2022-05-15 22:45:34
...
<?php
header("refresh:2;url=http://www.baidu.com");
header("location:http://www.baidu.com");
echo "<meta charset='UTF-8' http-equiv='refresh' content='2;url=https://www.ipa361.com'>";
echo "<script>window.location.href='http://www.taobao.com'</script>";
æè è¿æä¸ç§,form表åèªå¨æ交跳转
<html>
<head>
<meta charset="utf-8">
</head>
<body onload="load()">
<form id="formCommit" action="http://www.baidu.com" method="post">
<input type="hidden" id = "req" name="req" value="<?php echo htmlspecialchars($param['resp']);?>" />
<input type="hidden" id = "sign" name="sign" value="<?php echo htmlspecialchars($param['sign']);?>" />
</form>
<script type="text/javascript">
function load(){
document.getElementById("formCommit").submit();
}
</script>
</body>
</html>
php 大å°å转æ¢
// BigTechnologyLiterature 转æ big_technology_literature
public function get_table_name($model)
{
// å符串转æ°ç»,
$arr=str_split($model,1);
$str1=strtolower($arr[0]);
for ($i=1;$i<count($arr);$i++){
if(preg_match('/^[A-Z]+$/', $arr[$i]))
{
$str1.='_'.strtolower($arr[$i]);
}else{
$str1.=$arr[$i];
}
}
return $str1;
}
è·å表å段çå¤æ³¨
<?php
/**
* è·åæ°æ®åºå段注é
*
* @param string $table_name æ°æ®è¡¨å称(å¿
é¡»ï¼ä¸å«åç¼)
* @param string $field å段å称(é»è®¤è·åå
¨é¨å段,å个å段请è¾å
¥å段å称)
* @param string $table_schema æ°æ®åºå称(å¯é)
* @return string
*/
function get_db_column_comment($table_name = '', $field = true, $table_schema = ''){
// æ¥æ¶åæ°
$database = config('database');
$table_schema = empty($table_schema) ? $database['database'] : $table_schema;
$table_name = $database['prefix'] . $table_name;
// ç¼åå称
$fieldName = $field === true ? 'allField' : $field;
$cacheKeyName = 'db_' . $table_schema . '_' . $table_name . '_' . $fieldName;
// å¤çåæ°
$param = [
$table_name,
$table_schema
];
// å段
$columeName = '';
if($field !== true){
$param[] = $field;
$columeName = "AND COLUMN_NAME = ?";
}
// æ¥è¯¢ç»æ
$result = Db :: query("SELECT COLUMN_NAME as field,column_comment as comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = ? AND table_schema = ? $columeName", $param);
// pp(Db :: getlastsql());
if(empty($result) && $field !== true){
return $table_name . '表' . $field . 'å段ä¸åå¨';
}
// å¤çç»æ
foreach($result as $k => $v){
if(strpos($v['comment'], '#*#') !== false){
$tmpArr = explode('#*#', $v['comment']);
$data[$v['field']] = json_decode(end($tmpArr), true);
}
}
// å段注éæ ¼å¼ä¸æ£ç¡®
if(empty($data)){
return $table_name . '表' . $field . 'å段注éæ ¼å¼ä¸æ£ç¡®';
}
return count($data) == 1 ? reset($data) : $data;
}
print_r(get_db_column_comment('user','tp5'));
上一篇: 在MySQL concat里面使用多个单引号,三引号的问题
下一篇: PHP 函数的四种传参方式