Jump to content
php.lv forumi

array nodošana kā parametrs


aika

Recommended Posts

Ir vēlme uzzīmēt grafiku.

Problēma - kā nodot array zīmēšanas skriptam:

 

<img src='drow_image.php?ydata=???'> // ydata ir jābūt grafika vērtību arrajam!

 

Var protams apčakarēt ar stringu, kuru pēc tam sasplito arajā, bet var'but ir kāds tiešs veids kā nodot array?

Edited by aika
Link to comment
Share on other sites

kapēc ne... caur get mierīgi var padot masīvu

 

/script.php?masivs[2]=viens&masivs[1]=divi&masivs[3]=triis

 

Array
(
   [masivs] => Array
       (
           [2] => viens
           [1] => divi
           [3] => triis
       )

)

 

 

vai

 

/script.php?masivs[]=viens&masivs[]=divi&masivs[]=triis

 

Array
(
   [masivs] => Array
       (
           [0] => viens
           [1] => divi
           [2] => triis
       )

)

 

vai pat tā /script.php?masivs[a]=viens&masivs=divi&masivs[c]=triis

 

Array
(
   [masivs] => Array
       (
           [a] => viens
           [b] => divi
           [c] => triis
       )

)

Edited by J0ke
Link to comment
Share on other sites

kapēc ne... caur get mierīgi var padot masīvu

 

/script.php?masivs[2]=viens&masivs[1]=divi&masivs[3]=triis

Tu nepadod masīvu. Tu padod vairākus GET argumentus kā stringus (no JS viedokļa). To kā php galā tas tiek apstrādāts ir cita runa.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...