פורסם 2012 באפריל 2613 שנים שלום רב,אני זקוק לעזרה בנוגע לבעיה כללית שבה ניתקלתי עם המערך בקוד הבא:<?phperror_reporting(E_ALL ^ E_NOTICE);$filename="processes.txt"; //Read File$handle=fopen($filename,'r');$index = 0;$LineArray = array(); //Create An Array That Holds All Of The Linesif (is_readable($filename)){//reads Lines To An Array:while(!feof($handle)){$CurrentLine = fgets($handle);$LineArray[$index] = $CurrentLine;$index = $index + 1;}}fclose($handle);$index -= 3;while($index>=0){ //Display The File Back To The HTML$display .= '<li class="menu"> <a href="" onclick="Msg('.$index.');"> <img alt="Description" src="thumbs/other.png" /> <span class="name">'.$LineArray[$index].'</span> <span class="arrow"></span> </a> </li>';$index = $index - 1;} if(isset($_GET['process'])){ $value = ($_GET['process']); //$str = $LineArray[$value]; //This Line Doesnt Work Thats Why It's Deactivated $str = $value; // This Line Works But It's No Good To Me $newline=$str; $filename="close.txt"; $handle=fopen($filename,'w'); fwrite($handle,$newline); fclose($handle);}?>
פורסם 2012 באפריל 2613 שנים קודם כל אתה בודק אם הוא קריא לפני שאתה פותח את הקובץ, זה דבר ראשון. דבר שני המשתנה $_GET['process'] חייב להיות מספר תמיד אז תעשה עליו intval(). ולא ציינת מה לא עובד לך, או איך אתה רוצה שזה יעבוד.
פורסם 2012 באפריל 2613 שנים מחבר אוקיי,כפי שכבר הבנתם אני מנסה לכתוב אל הקובץ מחרוזת אשר נמצאת במערך בשם: LineArray.לאחר הטיפ שניתן לי הבעיה עדיין לא נפתרה אפילו אחרי שהמרתי את המשתנה Value ל-int.אני כבר אובד עצות אולי בגלל שהכל מתבצע אצלי ב- AJAX?$.ajax({type: "GET",url: "php/Main.php",data: { process : value }});
ארכיון
דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.