How To Remove A Site Line

Table of contents:

How To Remove A Site Line
How To Remove A Site Line

Video: How To Remove A Site Line

Video: How To Remove A Site Line
Video: How to Delete Remove Horizontal Line MS Word 2016 in Windows 10 Store 2024, December
Anonim

Removal of the obsolete, obsolete, hooligan, etc. strings can be a serious test for a site owner. Without going into the technical details of various platforms, let's look at the procedure for removing this line using PHP.

How to remove a site line
How to remove a site line

Instructions

Step 1

Determine the path to the file containing the unneeded line and its sequence number in the file. (Note that line numbering starts with one.) Begin creating the desired delete command."

Step 2

Create an array that is a copy of the data of the selected file: $ data = file (path_to_file); Determine the number of components included in it: $ count_data = sizeof ($ data);. Remove the unnecessary line using the formula id-1, since the numbering of the array components differs from document line numbering and starts from zero: unset ($ data [$ id-1]); Open the selected file to edit its contents: $ fp = fopen (path_to_file, a); Set the lock variable of the selected file flock ($ fp, LOCK_EX); and delete the incorrect contents of the file to be changed: ftruncate ($ fp, 0);.

Step 3

Create new content for the file to be modified: for ($ j = 0; $ j

Step 4

Complete the procedure for creating the required command to delete a line that has become unnecessary by entering the standard "?>" (Without quotes). Use the above procedure to create your own scripts to delete lines not only by number, but also by the identifier of the component to be deleted - id. To do this, set a string search variable containing the search identifier in the first field.

Step 5

Please note that there is no need to first check all generated scripts on test files in order to be able to recover all deleted data.

Recommended: