legend2 開發常用語句

2022-03-24 04:23:18 字數 3045 閱讀 6423

其實敲**都是很類似的,比如ajax,模型等等,敲**就是乙個由生到熟的過程$.post("", ,function (data)

11return

$back_data

;12 }

db::starttrans();

db::commit();

db::rollback();

1

//19、測試事務操作

2public

function

test18()else15}

1617

//18、測試事務操作

18public

function

test17() catch (\exception

$e)

34 }

location.reload();

location.reload();

用陣列

1

//將英雄的靈根數字字串轉化為漢子陣列

2public

static

function reikirootnormalize($reikiroot)8

return

$reikiroot

;9 }

還有比如判斷等級的

1

//計算英雄境界

2function calcherograde($grade

)

比如判斷公升級靈力的

1

//$reikigrowth:表示靈氣成長

2public

static

function getgradereiki($grade,$reikigrowth)11

$sum+=$num;12

$ans=;

13$ans['num']=intval($num);//

$grade哪一級的公升級經驗

14$ans['sum']=intval($sum);//

$grade那一級的總經驗

15return

$ans

;16 }

轉碼:addslashes(htmlspecialchars($data['a_content_art1']));

解碼:stripslashes(htmlspecialchars_decode($article['a_content_art1']));

轉碼

$data['a_content_art1']=addslashes(htmlspecialchars($data['a_content_art1']));

解碼(這個不行,要一一對應)

$article['a_content_art1']=stripslashes(htmlspecialchars_decode(stripslashes($article['a_content_art1'])));

這個

$val['bq_stem_info']=stripslashes(htmlspecialchars_decode($val['bq_stem_info']));

查詢:preg_match_all($pattern, $question['bq_answer'], $keywords);

替換:preg_replace($pattern,'', $question['bq_answer_clue']);

查詢

$pattern='/(.*?)<\/h5>/us';

preg_match_all($pattern, $question['bq_answer'], $keywords

);if(isset($keywords[1][0]))

db::starttrans();

//1、支付靈石

$equipment=db('equipment')->alias('e')->join('school_equipment se','se.se_e_id=e.e_id','left')->

join('template_equipment te','e.e_te_id=te.te_id','left')->find($e_id

);

//dump($equipment);die;

if(!isset($equipment['e_sold_price'])||!isset($equipment['se_num'])||$equipment['se_num']<1)

$need_money_num=intval($equipment['e_sold_price']/2);

if($need_money_num

<25) $need_money_num=25;

))

//2、支付活力

$need_vigour_num=intval($base_exp*$equipment['e_type_grade']*30/100/3);

))

//3、鑑定裝備操作:(鑑定裝備,原裝備數減1,如果裝備數為0,就刪除這條裝備)

);

if($identify_ans!==false

)else

//步驟三:將英雄石資訊返回到頁面

$back_data['school_equipments']=$school_equipments

;

$back_data['school']=$school

; }

return

$back_data

; }

頁面

//

1、鑑定裝備:e_id為裝備id,h_id為英雄id

function

identify_equipment()", ,function

(data) else

});}

}//2、使用裝備-->

直接在函式中套用提供的**即可

Mysql常用語句(2)

show databases create database student create table student id int auto increment,name varchar 30 not null,primary key id select from student limit 1 ...

mysql常用語句 MySQL常用語句

create table student id int primary key auto increment comment 學號 name varchar 200 comment 姓名 age int comment 年齡 comment 學生資訊 修改表注釋 alter table studen...

php mysql 常用語句 mysql常用語句

一 修改mysql使用者密碼 mysql h localhost u root p 命令列登入 update user set password password 123456 where user root 二 資料庫操作 show databases 顯示資料庫 create database ...