gpt4 book ai didi

mysql - 在mysql和Angular中输入unicode

转载 作者:行者123 更新时间:2023-11-29 22:13:22 28 4
gpt4 key购买 nike

假设我有一个输入,要求用户仅输入卡片上的字母。我们说“KdKc”。除了向用户显示 KDKC/kdkc/KdKc 之外,我还想显示套装的 unicode。 ⋄K♣

有人知道我该如何进行此转换吗?

我将它插入到表中,如下所示:

$hand = json_decode(file_get_contents("php://input"),true);
$hand_names = array('handNumber', 'hand');
$keys = array_keys($hand);
$columns = '';
$values = '';
foreach($column_names as $desired_key){ // Check the hand received. If blank insert blank into the array.
if(!in_array($desired_key, $keys)) {
$$desired_key = '';
}else{
$$desired_key = $hand[$desired_key];
}
$columns = $columns.$desired_key.',';
$values = $values."'".$$desired_key."',";
}
$query = "INSERT INTO hands_table(".trim($columns,',').") VALUES(".trim($values,',').")";
if(!empty($hand)){
$r = $this->mysqli->query($query) or die($this->mysqli->error.__LINE__);
$success = array('status' => "Success", "msg" => "Hand Created Successfully.", "data" => $hand);
$this->response($this->json($success),200);
}else
$this->response('',204); //"No Content" status

并通过 ng-repeat 显示

 <tr ng-repeat="data in customers">
<td>{{data.hand}}</td>
<td><a href="#/edit-hand/{{data.handNumber}}" class="btn">&nbsp;<i class="glyphicon glyphicon-edit"></i>&nbsp; Edit Hand</a></td>
</tr>

我很珍惜时间!

最佳答案

创建一个过滤器怎么样?工作plunker

app.filter('cardSymbol', function() {
return function(input) {
if (!input) {
return input;
}
input = input.replace(/s/g, '\u2660');
input = input.replace(/h/g, '\u2665');
input = input.replace(/d/g, '\u2666');
input = input.replace(/c/g, '\u2663');
return input;
}
});

关于mysql - 在mysql和Angular中输入unicode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31420180/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com