我想知道是否有一种方法不会自动将我的数据从“.data”格式化为“_data”或将“数据名称”格式化为“data_name”?
if (!empty($_POST)) {
foreach ($_POST as $app_id=>$val) {
if ($app_id != "submit") {
$prof_rate = $_POST[$app_id];
$tokens = explode("-", $app_id);
$label = $tokens[0];
$applicationId = $tokens[1];
// insert query technology_results
echo $label.":".$prof_rate."<br/>";
}
}
} else {
$app_val_err = "Error Message!";
}
最佳答案
我们可以尝试使用 preg_replace
将所有空格和点替换为下划线:
$input = "some.name here";
$output = preg_replace("/[ .]/", "_", $input);
关于php - 自动更改空格和下划线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52712812/