Php variables are too long to be processed-php Tutorial

Source: Internet
Author: User
Php variables are too long to be processed.

$ A = "long stuff @ Long stuff @... ";
$ B = explode ("@", $ );
Foreach ($ B as $ k => $ v)
{... // Enter the database}
// $ A is too long. you can delete a large number of items to perform the operation normally.
What should I do?


Reply to discussion (solution)

The string length should not be a direct cause. it is estimated that too many arrays are the main cause.
Therefore, consider stream reading strings, read part of the extracted regular part of the processing, then read the next part, splice the first part to extract the remaining ...... Follow this cycle

The first time I heard that variables are too long to be processed, I suggest you give an example. Why can't I handle it "?

I used excel to import the csv format, convert it to a json string using vba, and send it to php through the page. the result of the check is that there is a problem during excel conversion, format Error

{... // Enter the database}

Whether it is your database table or not, and the length of the field is set.

Is your memory too small?

Is the insert failure caused by addslashes not used?

The field type you write is set to text type, and is converted to {...} json type to be inserted into the database field.

1. split into multiple parts according to certain rules
2. process each copy in a loop

I learned from the great gods that the original explode
The function cannot contain long characters and later uses regular expressions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.