簡體   English   中英

如何從db獲取字符串值,為服務器端處理設置整數?

[英]How can i get string value from db which sets integer for server-side processing?

我正在使用Datatables示例,我想獲得性別的字符串值:' 男性 '或' 女性 '而不是12

我的性別config.php代碼:

$gender = [1 => "Male", "Female"];

這是我的server-processing.php代碼,它返回整數:

array( 'db' => 'gender', 'dt' => 4)

誰能幫我解決這個問題?

常見問題,我這樣做:

使用數組位置1和2中的性別字符串創建和數組。

$genders = array('','Male', 'Female');

$gender = $genders[$genderValue];

其中$genderValue等於男性1或女性2。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM