The pit Father's regular, ask

Source: Internet
Author: User
config.php$_lang[' new_arrival '       = ' new arrivals '; $_lang[' hot_products ']   = ' hot products '; $_lang[' Group_ Deals ']     = ' Group deals '; $_lang[' specials ']            = "Specials"; $_lang[' after ')            = ' Contact cu\ ' Stomer 
 
  
  
Service for
Order Status and
Other after-sales issues
'; $_lang[' group_deals ' = ' group deals '; $subject = file_get_contents ("config.php"); $pattern = ' How to write here '; preg_ Match_all ($pattern, $subject, $matches); Print_r ($matches); I want to take out everything after the equals sign, how do I write it? Note the symbols in the string after the equals sign (single quotation marks, double quotes, escaped Fu Yi, and line breaks are taken). The results are as follows: 1. ' New arrivals ' 2. ' Hot ' 3. ' Group Deals ' 4. "Specials" 5. ' Contact Cu\ ' Stomer
Service for
Order Status and
Other after-sales issues
'


Reply to discussion (solution)

Can't think of, you are the number of the group can be directly through the key name to take what to do with the regular! And why are you using file_get_contents to get the data from config.php? You can simply return that array and manipulate it directly through the array.

$subject =<<< ' TXT ' $_lang[' new_arrival ']       = ' new arrivals '; $_lang[' hot_products ']   = ' hot products '; $ _lang[' group_deals '     = ' group deals '; $_lang[' specials ']            = "Specials"; $_lang[' after ')            = ' Contact cu\ ' Stomer 
 
  
  
Service for
Order Status and
Other after-sales issues
'; $_lang[' group_deals '] = ' Group deals '; TXT; $pattern = '/.*=\s* (. +);/su '; Preg_match_all ($pattern, $subject, $matches); Print_r ($matches [1]);
Array
(
[0] = ' New arrivals '
[1] = ' hot Products '
[2] = ' Group Deals '
[3] = "Specials"
[4] = ' Contact cu\ ' Stomer


Service for
Order Status and
Other after-sales issues
'
[5] = ' Group Deals '
)

Technical master, CSDN or quite a lot of.

config.php General include enter the reading group to take a value on the line

=\s ([' "" "a-za-z1-9\s<>\/\\-]*)

=\s* ([' "" "a-za-z1-9\s<>\/\\-]*)

config.php General include enter the reading group to take a value on the line

Well. Arrays can be used directly. But it's not my problem, ha.

  • 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.