我有这个
$ids = array_map(array($this, 'myarraymap'), $data['student_teacher']);
function myarraymap($item) {
return $item['user_id'];
}
Run Code Online (Sandbox Code Playgroud)
我想在我的函数中添加一个其他参数来获得类似的东西
function myarraymap($item,$item2) {
return $item['$item2'];
}
Run Code Online (Sandbox Code Playgroud)
有人可以帮助我吗?我尝试了很多东西,但没有任何效果
.我有两个阵列
第一
Array
(
[0] => Array
(
[date] => 2012-01-10
[result] => 65
[name] => Les océans
)
[1] => Array
(
[date] => 2012-01-11
[result] => 75
[name] => Les mers
)
[2] => Array
(
[date] => 2012-01-13
[result] => 66
[name] => Les continents
[type] => Scores
)
)
Run Code Online (Sandbox Code Playgroud)
第二
Array
(
[0] => Array
(
[date_end] => 2012-01-12
[result] => 60
[name] => Step#1
[type] => Summary
)
)
Run Code Online (Sandbox Code Playgroud)
我希望这是我的最终结果
Array
(
[0] => Array …Run Code Online (Sandbox Code Playgroud) 嗨,我需要将权限777放到我上传的文件中,但我没有在codeigniter中找到任何上传文件的文档...是否可以将权限777与codeigniter的上传类放在一起?
$ group_id = $ this-> input-> post('group_id',TRUE);
// unlink('static/images/uploads/44');
// rmdir('static/images/uploads/45');
$dir = is_dir('../www/static/images/uploads/'.$group_id);
if($dir){
$config['upload_path'] = '../www/static/images/uploads/'.$group_id;
echo "test";
}
else{
mkdir('../www/static/images/uploads/'.$group_id, 0777);
$config['upload_path'] = '../www/static/images/uploads/'.$group_id;
}
$config['allowed_types'] = 'docx|pdf|doc|gif|jpg|png|tiff';
$config['max_size'] = '10000000';
$config['max_width'] = '999999';
$config['max_height'] = '99999';
$this->load->model('Teacher_model');
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
print_r($error);
//$this->load->view('school/teacher/upload_form', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
$name = $this->input->post('name', TRUE);
$path = $data['upload_data']['file_name'];
$group_id = $this->input->post('group_id', TRUE);
$this->Teacher_model->add_ressources($group_id,$name,$path);
redirect('school/teachers/#tabs_group_ressource'.$group_id, 'location', 301); …Run Code Online (Sandbox Code Playgroud) 我试图从数组中获得第二高的值,我只是想知道是否可以执行类似MAX -1的操作,或者我绝对需要按表排序并获得第二高的值
private function max_key($array) {
foreach ($array as $key => $val) {
if ($val == max($array)) return $key;
}
}
Run Code Online (Sandbox Code Playgroud) 起初我有这个(在wamp工作但不在我的web服务器中)
$ids = array_map(function($item) { return $item['user_id']; }, $data['student_teacher']);`
Run Code Online (Sandbox Code Playgroud)
所以我尝试将代码转换为该代码,但没有任何工作(我从输出端获得数组,数组,数组,数组,数组,数组)
$ids = array_map($this->myarraymap(null), $data['student_teacher']);
function myarraymap($item) {
return $item['user_id'];
}
Run Code Online (Sandbox Code Playgroud) 是否有可能像chjQuery网站那样在jQuery中预加载?
我问,因为我有一个Web应用程序,我的第一页有很多脚本需要加载,页面在加载时显示丑陋2-4秒,所以我需要预加载.有人知道插件吗?
当我创建一个数组元素时,我需要设置一个条件
foreach ($score as $item):
if ($item['subject_id'] == "3"){
$file_data_array[] = array(
"y" => $item['result'],
////Need condition here///////////////////////////////
"color" => '#FFF'
);
}
endforeach;
Run Code Online (Sandbox Code Playgroud)
所以我需要一个像这样的条件
if ($item['confirmed'] == 1) {
"color" => '#FFF'
} else {
"color" => '#000'
}
Run Code Online (Sandbox Code Playgroud)
所以,既然我们不能把一个if数组放入一个数组内,我该如何处理我的情况呢?