在 Codeigniter 中添加两个输入值作为字符串

Add two input values as string in Codeigniter

我正在尝试将两个输入值作为字符串而不是数字相加,问题是它们实际上是数字。

'clabe' => $this->input->post('clabe2') + $this->input->post('dc') 

其中 clabe2 = 123 且 dc = 4;

我想要得到的结果是 1234 而不是 127

任何帮助将不胜感激

连接这个并赋值给变量 像这样:

$var = $this->input->post('clabe2') . $this->input->post('dc');
'clabe' => $var

做这样的事情

使用连接运算符.进行字符串连接

'clabe' => $this->input->post('clabe2') . $this->input->post('dc');

更多:http://php.net/manual/en/language.operators.string.php