PDA

View Full Version : چاپ آرایه چند بعدی



mshoping
چهارشنبه 08 بهمن 1393, 08:51 صبح
سلام دوستان یه آرایه هست به این صورت میخوام به مقادیرش دسترسی پیدا کنم میشه راهنمایی کنید ؟؟




array(9) {
[0]=>
array(8) {
["id"]=>
string(2) "40"
["att_id"]=>
NULL
["userid"]=>
string(1) "0"
["name"]=>
string(13) "Jellyfish.jpg"
["type"]=>
string(1) "4"
["datetime"]=>
string(19) "2015-01-26 10:57:31"
["description"]=>
string(0) ""
["path"]=>
string(21) "uploads/Jellyfish.jpg"
}
[1]=>
array(8) {
["id"]=>
string(2) "42"
["att_id"]=>
NULL
["userid"]=>
string(1) "0"
["name"]=>
string(17) "Chrysanthemum.jpg"
["type"]=>
string(1) "4"
["datetime"]=>
string(19) "2015-01-26 12:56:43"
["description"]=>
string(91) "توضیحاتی مربوط به فایل است که اینجا قرار گرفته است"
["path"]=>
string(25) "uploads/Chrysanthemum.jpg"
}
[2]=>
array(8) {
["id"]=>
string(2) "43"
["att_id"]=>
NULL
["userid"]=>
string(1) "0"
["name"]=>
string(10) "Desert.jpg"
["type"]=>
string(1) "4"
["datetime"]=>
string(19) "2015-01-26 12:57:52"
["description"]=>
string(0) ""
["path"]=>
string(18) "uploads/Desert.jpg"
}
[3]=>
array(8) {
["id"]=>
string(2) "44"
["att_id"]=>
string(1) "0"
["userid"]=>
string(1) "0"
["name"]=>
string(40) "35347142029686021582_FireShot Screen.png"
["type"]=>
string(1) "3"
["datetime"]=>
string(19) "2015-01-26 12:58:29"
["description"]=>
string(2) "ok"
["path"]=>
string(48) "uploads/35347142029686021582_FireShot Screen.png"
}
[4]=>
array(8) {
["id"]=>
string(2) "45"
["att_id"]=>
NULL
["userid"]=>
string(1) "0"
["name"]=>
string(40) "35347142029686021582_FireShot Screen.png"
["type"]=>
string(1) "3"
["datetime"]=>
string(19) "2015-01-26 12:59:02"
["description"]=>
string(0) ""
["path"]=>
string(48) "uploads/35347142029686021582_FireShot Screen.png"
}
[5]=>
array(8) {
["id"]=>
string(2) "46"
["att_id"]=>
NULL
["userid"]=>
string(1) "0"
["name"]=>
string(14) "555228mapp.jpg"
["type"]=>
string(1) "4"
["datetime"]=>
string(19) "2015-01-27 09:54:20"
["description"]=>
string(0) ""
["path"]=>
string(22) "uploads/555228mapp.jpg"
}
[6]=>
array(8) {
["id"]=>
string(2) "51"
["att_id"]=>
NULL
["userid"]=>
string(1) "0"
["name"]=>
string(6) "11.jpg"
["type"]=>
string(1) "4"
["datetime"]=>
string(19) "2015-01-27 15:34:19"
["description"]=>
string(29) "این توضیحات است "
["path"]=>
string(14) "uploads/11.jpg"
}
[7]=>
array(8) {
["id"]=>
string(2) "52"
["att_id"]=>
NULL
["userid"]=>
string(2) "65"
["name"]=>
string(18) "کمیببمننت"
["type"]=>
NULL
["datetime"]=>
string(19) "2015-01-27 15:36:02"
["description"]=>
string(18) "تالتلتالت"
["path"]=>
string(0) ""
}
[8]=>
array(8) {
["id"]=>
string(2) "53"
["att_id"]=>
NULL
["userid"]=>
string(1) "0"
["name"]=>
string(9) "test.docx"
["type"]=>
string(1) "6"
["datetime"]=>
string(19) "2015-01-28 07:40:45"
["description"]=>
string(0) ""
["path"]=>
string(17) "uploads/test.docx"
}
}



ممنون میشم یه نفر راهنمایی کنه

مهرداد سیف زاده
چهارشنبه 08 بهمن 1393, 11:24 صبح
<?php


$data = array(
array(
"id"=>"45",
"att_id"=>NULL,
"userid"=>"0",
"name"=>"35347142029686021582_FireShot Screen.png",
"type"=>"3",
"datetime"=>"2015-01-26 12:59:02",
"description"=>"",
"path"=>"uploads/35347142029686021582_FireShot Screen.png"
),
array(
"id"=>"46",
"att_id"=>NULL,
"userid"=>"0",
"name"=>"35347142029686021582_FireShot Screen.png",
"type"=>"3",
"datetime"=>"2015-01-26 12:59:02",
"description"=>"",
"path"=>"uploads/35347142029686021582_FireShot Screen.png"
),
array(
"id"=>"47",
"att_id"=>NULL,
"userid"=>"0",
"name"=>"35347142029686021582_FireShot Screen.png",
"type"=>"3",
"datetime"=>"2015-01-26 12:59:02",
"description"=>"",
"path"=>"uploads/35347142029686021582_FireShot Screen.png"
),
);


foreach ($data as $key => $value) {
echo $value['id']."\n";
}

mshoping
چهارشنبه 08 بهمن 1393, 13:37 عصر
<?php


$data = array(
array(
"id"=>"45",
"att_id"=>NULL,
"userid"=>"0",
"name"=>"35347142029686021582_FireShot Screen.png",
"type"=>"3",
"datetime"=>"2015-01-26 12:59:02",
"description"=>"",
"path"=>"uploads/35347142029686021582_FireShot Screen.png"
),
array(
"id"=>"46",
"att_id"=>NULL,
"userid"=>"0",
"name"=>"35347142029686021582_FireShot Screen.png",
"type"=>"3",
"datetime"=>"2015-01-26 12:59:02",
"description"=>"",
"path"=>"uploads/35347142029686021582_FireShot Screen.png"
),
array(
"id"=>"47",
"att_id"=>NULL,
"userid"=>"0",
"name"=>"35347142029686021582_FireShot Screen.png",
"type"=>"3",
"datetime"=>"2015-01-26 12:59:02",
"description"=>"",
"path"=>"uploads/35347142029686021582_FireShot Screen.png"
),
);


foreach ($data as $key => $value) {
echo $value['id']."\n";
}


بقیه قسمت ها رو خطا میده کلید های دیگه رو خطا میده
ممنون میشم راهنمایی کنید

مهرداد سیف زاده
چهارشنبه 08 بهمن 1393, 14:09 عصر
کلیدهای دیگه رو چه خطایی میده؟ شاید دارید نام کلید رو اشتباه میدید بهش

mshoping
چهارشنبه 08 بهمن 1393, 14:25 عصر
خیر کلید ها مشخصه هست توی کد




array( "id"=>"45", "att_id"=>NULL, "userid"=>"0", "name"=>"35347142029686021582_FireShot Screen.png", "type"=>"3", "datetime"=>"2015-01-26 12:59:02", "description"=>"", "path"=>"uploads/35347142029686021582_FireShot Screen.png" ),




خطای undefine میده




Notice: Undefined index: path in E:\Xampp\htdocs\upcenter\index.php on line 11

مهرداد سیف زاده
چهارشنبه 08 بهمن 1393, 15:49 عصر
اجرای کد زیر رو در لینک زیر ببینید
https://ideone.com/Meavc5

mshoping
چهارشنبه 08 بهمن 1393, 18:56 عصر
اجرای کد زیر رو در لینک زیر ببینید
https://ideone.com/Meavc5

داداش حل شد ممنون از پاسخت خیلی ممنون