Urgent !! Incomplete loading of php pages, online and other PHP
RT: refresh the same page multiple times. sometimes it is normal, sometimes it is only half displayed, and sometimes it is completely blank.
Complete page
Half
This problem was not encountered during local debugging, which occurred during the release of the Internet. The content in the drop-down box opens a. tab file with fopen, reads it, converts it into an array through loops, and assigns values to the js array through loops. The loop is 1000.
Set_time_limit (60*60*10) is invalid...
Thank you for your guidance... Attach some code
Common. php
404 File not found!") ;}$ Handle = fopen ($ fileName, 'RB'); $ contents = fread ($ handle, filesize ($ fileName); // iconv (" UTF-8 ", "GBK", $ contents); if (ord ($ contents) = 0xEF) {$ contents = substr ($ contents, 4 );} $ rows = explode ("\ r \ n", $ contents); fclose ($ handle); $ ret; $ colNames = null; for ($ I = 0; $ I <count ($ rows); $ I ++) {$ row = $ rows [$ I]; if (! Empty ($ row) & $ row! = "" & Substr ($ row, 0, 1 )! = "#") {$ Col = explode ("\ t", $ row); if (empty ($ colNames) | $ colNames = null) $ colNames = $ col; else {$ item; $ itemId = (int) $ col [0]; if (empty ($ itemId) {die ("... ") ;}for ($ j = 0; $ j <count ($ col); $ j ++) {$ value = $ col [$ j]; $ item [$ colNames [$ j] = $ value;} $ ret [$ itemId] = $ item ;}} return $ ret ;}?> Test. php
Script var goodsTb = new Array ();
$ Value) {echo "goodsTb [". $ value ["id"]. "] = \"". iconv ("GBK", "UTF-8", $ value ["sz_name"]). "\"; ";}?> Function checkNum (I) {var sle_obj = document. getElementById ('valuetype '+ I); var index = sle_obj.selectedIndex; var valueType = sle_obj.options [index]. value; var num_obj = document. getElementById ('count' + I); if (valueType =-1) {alert ('select the item type! ');} If (num_obj.value> 500) num_obj.value = 500;} var I = 1; function addFile () {var dv = document. getElementById ("dvFiles"); var selectObj = document. createElement ("select"); selectObj. name = "valueType"; selectObj. id = "valueType" + I; var sg = document. createTextNode ("Select item"); dv. appendChild (sg); // create the select tab var myOption = document. createElement ("option"); myOption. setAttribute ("value", "-1"); myOption. appendChild (document. createTextNode ("none"); selectObj. appendChild (myOption); for (var key in goodsTb) {var op = document. createElement ("option"); op. setAttribute ("value", key); op. appendChild (document. createTextNode (goodsTb [key]); selectObj. appendChild (op);} dv. appendChild (selectObj );....
Reply to discussion (solution)
Sorry | !!
Online and so on.
Manager
Sometimes the code is normal.
What does Full blank mean? Does the entire page contain a single word?
Most of these are network problems and do not have much to do with the code, unless your program algorithm is too complex, resulting in no response within the browser timeout range
That is, there is no blank word...
The algorithm is not complicated... There are only two 1000 loops, and I have also posted the code...
But it must be related to the network. local debugging is normal...
The reason for the blank is that js contains a loop. when JavaScript is executed halfway, it stops... Solution
The reason for the blank is that js contains a loop. when JavaScript is executed halfway, it stops... Solution
This may be caused by js performance issues.
We strongly recommend that you use php for loop. for example, you can use the smarty template to pass the array to the display template, loop inside and then return the html returned by the loop or output the foreground
Do not use js loop anymore
The reason for the blank is that js contains a loop. when JavaScript is executed halfway, it stops... Solution
This may be caused by js performance issues.
We strongly recommend that you use php for loop. for example, you can use the smarty template to pass the array to the display template, loop inside and then return the html returned by the loop or output the foreground
Do not use js loop anymore
I am not very familiar with js--, but from the code execution on the ff page, it is true that the code in the previous section has not been executed, and the array obtained by php is correct, it stops when js is output.
I have never understood the smarty template. Is there a solution for js?
If you use php to output js directly, you cannot use it... I feel that the output is incomplete...
Another possibility is that the memory size limit of the server has this impact.
The reason for the blank is that js contains a loop. when JavaScript is executed halfway, it stops... Solution
This may be caused by js performance issues.
We strongly recommend that you use php for loop. for example, you can use the smarty template to pass the array to the display template, loop inside and then return the html returned by the loop or output the foreground
Do not use js loop anymore
I am not very familiar with js--, but from the code execution on the ff page, it is true that the code in the previous section has not been executed, and the array obtained by php is correct, it stops when js is output.
I have never understood the smarty template. Is there a solution for js?
I think there must be some solutions and optimization methods for JS.
But I cannot mention it here.
I only recommend using PHP for loop.
If you don't understand smarty, it's okay to loop directly in php and use echo to spell out html
Why do we have to use js for loop and combination?
echo $str;foreach($table as $key => $value){echo 'var op = document.createElement(\"option\");';echo 'op.setAttribute(\"value\", "'.$value["id"].'");';echo 'op.appendChild(document.createTextNode("'.iconv("GBK","UTF-8", $value["sz_name"]).'"));';echo 'selectObj.appendChild(op)';}?>
Php is not used to output Html ...........
Khan, you used php to output a bunch of js statements ....
Can I directly output html in PHP .......
After reading about your page, there may be several associated select lists at most, and ajax may be used to retrieve data in the background. php outputs: html + js, submit, query, and select. why every line of code is JavaScript code? what about
After reading about your page, there may be several associated select lists at most, and ajax may be used to retrieve data in the background. php outputs: html + js, submit, query, and select. why every line of code is JavaScript code? what about
The first drop-down box is the html directly output by php, but there is an add button, a new drop-down box will be generated every time .... Currently, Js is used to add buttons.
After reading about your page, there may be several associated select lists at most, and ajax may be used to retrieve data in the background. php outputs: html + js, submit, query, and select. why every line of code is JavaScript code? what about
The first drop-down box is the html directly output by php, but there is an add button, a new drop-down box will be generated every time .... Currently, Js is used to add buttons.
Click Add and a drop-down box for selecting item items appears, right?
Is it different from the previous one?
If there is no difference, simply insert the html into the lower p of the previous drop-down list.
Assume that the class of the first drop-down box is abc, and the drop-down box and the input box behind it are under the same p
$ (". Abc"). parent (). after ($ (". abc" ).parent().html ());
Jquery is implemented in one sentence.
What should I do? the finer the business details, the more I can't say, because I don't know.
In fact, I mean, in the final analysis, there is no need to use complicated js loops, so that the pages cannot be displayed in many ways.
Okay, it's really easy to use jquery --
May I ask $ (". abc"). after ($ (". abc" ).html (); can I modify the id and name of the assigned content?
Are you using any third-party template plug-ins? this is generally caused by the internal cache function of the template.
Okay, it's really easy to use jquery --
May I ask $ (". abc"). after ($ (". abc" ).html (); can I modify the id and name of the assigned content?
Of course, this is another problem.
Check the structure of your select List and the method of writing your js file.
For example, if you define a custom attribute for each item, such as val = "id1234"
Then, when you select an item, use js to get the val and text description of the selected item.
Then store it in the input value (it is very convenient to use the jquery selector)
This is a simple js application.
Are you using any third-party template plug-ins? this is generally caused by the internal cache function of the template.
No plug-ins are used...
Okay, it's really easy to use jquery --
May I ask $ (". abc"). after ($ (". abc" ).html (); can I modify the id and name of the assigned content?
Of course, this is another problem.
Check the structure of your select List and the method of writing your js file.
For example, if you define a custom attribute for each item, such as val = "id1234"
Then, when you select an item, use js to get the val and text description of the selected item.
Then store it in the input value (it is very convenient to use the jquery selector)
This is a simple js application.
Jquery has never been used, but some syntax can be learned by referring to the document...
The earliest graph I pasted is the number of items that I need to fill in after selecting an item, that is, a select and a text,
Click Add, $ (". abc "). after ($ (". abc ").html () will lead to select, text id is the same as the original, I want to distinguish, for example, using a variable I control, each time I is added, 1 is added...
In addition, you can click the delete button next to the item you want to add to delete the item. For more information, see --
Okay, it's really easy to use jquery --
May I ask $ (". abc"). after ($ (". abc" ).html (); can I modify the id and name of the assigned content?
Of course, this is another problem.
Check the structure of your select List and the method of writing your js file.
For example, if you define a custom attribute for each item, such as val = "id1234"
Then, when you select an item, use js to get the val and text description of the selected item.
Then store it in the input value (it is very convenient to use the jquery selector)
This is a simple js application.
Jquery has never been used, but some syntax can be learned by referring to the document...
The earliest graph I pasted is the number of items that I need to fill in after selecting an item, that is, a select and a text,
Click Add, $ (". abc "). after ($ (". abc ").html () will lead to select, text id is the same as the original, I want to distinguish, for example, using a variable I control, each time I is added, 1 is added...
In addition, you can click the delete button next to the item you want to add to delete the item. For more information, see --
Sorry.
I wrote a simple demo. I can search for related articles online only when I add and delete the selected DIV and write the value.
Document