Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Dreamweaver regular expressions to completely solve Session Cookie errors, XML parsing errors and whitespace in zencart

2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article is about how to use Dreamweaver regular expressions to completely solve Session Cookie errors, XML parsing errors, and white space in zencart. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Possible errors in zencart are as follows:

1) Session\ Cookie reported an error, such as:

Warning: session_start () [function.session-start]: Cannot send session cookie-headers already sent by (output started at E:\ web\ Apache\ mydalle\ index.php:1) in E:\ web\ Apache\ mydalle\ functions\ sessions.php on line 108

Cause: this error is because zencart already has output before dealing with the functions session-start (), cookie (), and header (). Because the scope of index.php is too wide, it is difficult to determine which file reported the error, especially setting some SEO.

2), XML parsing error

XML parsing error: xml processing instruction is not at the beginning of the entity

Location: http://www.mydalle.com/index.php?main_page=rss_feed&feed=new_products

Row: 8, column: 1:

^

Reason: this error is that when zencart installs the rss feed plug-in and calls rss, there is already a blank line or other output when outputting the XML header definition, or it may be almost the same error as 1). Because some of the code is not standard, forbidding the output of blank lines in front of header is not the best solution.

On the Internet, it is introduced to delete the last two blank lines of includes/languages/english.php and the last blank lines of includes/languages/english/meta_tags.php, but if other plug-ins and source code generate blank lines, the problem is still not solved, so it is not Firefox's problem, and so is IE.

Some people say that find / includes/classes/rss_feed.php file to set the variable value of this line $feedContent to null, in fact, this is a wrong solution, the front blank line still exists, the error still exists, even if lucky to solve, but the solution is not completely like a ticking time bomb.

3), blank page

Cause: it usually occurs on the home page or the shopping cart Add To Cart page, and this error is also likely to be caused by blank lines.

As can be seen from the above, the most fundamental reasons for such errors are:

The functions session-start (), cookie (), and header () already have output before, causing a serious error. But PHP's error report can't find out where the blank line came from.

My solution is to use Dreamweaver regular expressions to solve this problem, and for now it is thorough.

I use Dreamweaver, just click Edit-find and replace, and then select a folder. I only need to deal with the includes folder to solve this problem. Then select the source code and select the check box that uses the regular expression. Finally, choose to replace all.

The methods are as follows:

The first step is to delete all blank lines with regular expressions (it doesn't have to be done, I'm just trying to standardize and save code)

To put

\ n [\ s |] *\ r

Replace all with

\ n

The second step is to delete the first and last blank lines with the regular expression (this must be done, that is, delete the output that produces the error. )

^ [\ s |] *\ n |\ n [\ s |] * $

Replace all with

(replace with nothing in the fill box)

Note that regular expressions don't have too many spaces, you can test them with a file first. Back up once before the last replacement.

After the above two steps are done, the error will be solved. I can just replace the files in includes. Other documents have not been dealt with, and our situation may be different.

Later, after my investigation, it turned out that it was the problem of the templates folder. Templates is something we often change, which is inevitable.

Thank you for reading! On "how to use Dreamweaver regular expressions to completely solve Session Cookie errors, XML parsing errors and blanks in zencart" this article shares here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report