Php 获取vsprintf()以设置第三个参数/lastname

Php 获取vsprintf()以设置第三个参数/lastname,php,codeigniter,Php,Codeigniter,在我的serialize()中,我有3个参数。成员id、firtname和lastname a:3:{s:9:"member_id";s:1:"1";s:9:"firstname";s:7:"John";s:8:"lastname";s:12:"Doe";} 正如你所看到的,它只说出了第一个名字 电流输出 <a href="http://www.example.com/admin/member/profile/?member_id=1">John</a> 应该是什

在我的serialize()中,我有3个参数。成员id、firtname和lastname

a:3:{s:9:"member_id";s:1:"1";s:9:"firstname";s:7:"John";s:8:"lastname";s:12:"Doe";}
正如你所看到的,它只说出了第一个名字

电流输出

<a href="http://www.example.com/admin/member/profile/?member_id=1">John</a>

应该是什么

<a href="http://www.example.com/admin/member/profile/?member_id=1">John Doe</a>

问题:如何确保在vsprintf()中也可以获得姓氏

公共功能测试(){
$this->data['logs']=array();
$logs=$this->log_model->getlogs();
foreach($log作为$log记录){
$comment=vsprintf('logged in.',取消序列化($log['log_text']);
$find=数组(
“成员id”
);
$replace=数组(
站点url('admin/member/profile/?member\u id')
);
$this->data['logs'][]=数组(
'comment'=>str_replace($find,$replace,$comment),
'date_added'=>date(“fjs,yh:i:sa,$log['log_date']))
);
}
}

我现在添加了解决方案
%3$s

$comment = vsprintf('<a href="member_id=%d">%s %3$s</a> logged in.', unserialize($log['log_text']));
$comment=vsprintf('logged in.',取消序列化($log['log_text']);

在格式字符串中添加第三个占位符。为什么要投反对票?这个问题没问题。
$comment = vsprintf('<a href="member_id=%d">%s %3$s</a> logged in.', unserialize($log['log_text']));