文本内容
7 业务类型:淘宝 推荐物流
客户下单时间:2013-07-01 13:15:41
发货人姓名: 锐锐
邮编:510510
电话:
手机: 1356004XXXX
发货人地址: 广东省 广州市 天河区 XXXXXXXXXXXXXXXXXXXXXX
商品名:点击查看
商品数量:1
物流号:LP00015767554XXX
运单号: 297915XXXX
上门取货段: 至
备注:
收货人姓名: 蒋X
邮编:4
电话:
手机: 1820783XXXX
收货人地址: 广西壮族自治区 XXXXXXXXXXXXXXXX
预分配网点:750001 广东省江门市
接单情况:已分配网点
接单网点:
8 业务类型:淘宝 推荐物流
客户下单时间:2013-07-01 13:15:40
发货人姓名: 锐锐
邮编:510510
电话:
手机: 1356004XXXX
发货人地址: 广东省 广州市 XXXXXXXXXXXXXXXXXXXXXXX
商品名:点击查看
商品数量:2
物流号:LP00015772361XXX
运单号: 29791555XX
上门取货段: 至
备注:
收货人姓名: 刘X
邮编:4
电话:
手机: 1332001XXXX
收货人地址: 江西省 南昌市 XXXXXXXXXXXXXXXXXXXX
预分配网点:750001 广东省江门市
接单情况:已分配网点
接单网点:
9 业务类型:淘宝 推荐物流
客户下单时间:2013-07-01 13:15:37
发货人姓名: 锐锐
邮编:510510
电话:
手机: 1356004XXXX
发货人地址: 广东省 广州市 天河区 XXXXXXXXXXXXXXXXXXXXXX
商品名:点击查看
商品数量:1
物流号:LP00015771613XXX
运单号: 29791555XX
上门取货段: 至
备注:
收货人姓名: 闫X
邮编:4
电话:
手机: 1514809XXXX
收货人地址: 内蒙古自治区 呼和浩特市 XXXXXXXXXXXXXXXX
预分配网点:750001 广东省江门市
接单情况:已分配网点
接单网点:
要获取的内容是红色字体
回复讨论(解决方案)
function fetchHtml($html, $start, $end) { $f = sprintf("/%s(.*)%s/isU", preg_quote($start, "/"), preg_quote($end, "/")); preg_match_all($f, $html, $match); return $match[1]; }function desc($text){ $array=$this->fetchHtml($text,"业务类型","接单情况"); foreach($array as $key=>$value){ $name=$this->fetchHtml($value,"发货人姓名:","邮编"); $res[$key]['name']=trim($name['0']); $telephone=$this->fetchHtml($value,"手机:","发货人地址"); $res[$key]['telephone']=trim($telephone['0']); $address=$this->fetchHtml($value,"发货人地址:","商品名"); $res[$key]['address']=trim($address['0']); $code=$this->fetchHtml($value,"运单号:","上门取货段"); $res[$key]['code']=trim($code['0']); $name2=$this->fetchHtml($value,"收货人姓名:","邮编"); $res[$key]['name2']=trim($name2['0']); $telephone2=$this->fetchHtml($value,"收货人姓名","人地址"); $telephone2=$this->fetchHtml($telephone2['0'],"手机:","收货"); $res[$key]['telephone2']=trim($telephone2['0']); $address2=$this->fetchHtml($value,"收货人姓名","配网点"); $address2=$this->fetchHtml($address2['0'],"收货人地址:","预分"); $res[$key]['address2']=trim($address2['0']); } return $res; }$text=".........................";$array=$this->desc($text);print_r($array);
$text里面把你那一大段文本拷进去。
运行的结果是这样的。
array ( 0 => array ( 'name' => '锐锐', 'telephone' => '1356004XXXX', 'address' => '广东省 广州市 天河区 XXXXXXXXXXXXXXXXXXXXXX', 'code' => '297915XXXX', 'name2' => '蒋X', 'telephone2' => '1820783XXXX', 'address2' => '广西壮族自治区 XXXXXXXXXXXXXXXX', ), 1 => array ( 'name' => '锐锐', 'telephone' => '1356004XXXX', 'address' => '广东省 广州市 XXXXXXXXXXXXXXXXXXXXXXX', 'code' => '29791555XX', 'name2' => '刘X', 'telephone2' => '1332001XXXX', 'address2' => '江西省 南昌市 XXXXXXXXXXXXXXXXXXXX', ), 2 => array ( 'name' => '锐锐', 'telephone' => '1356004XXXX', 'address' => '广东省 广州市 天河区 XXXXXXXXXXXXXXXXXXXXXX', 'code' => '29791555XX', 'name2' => '闫X', 'telephone2' => '1514809XXXX', 'address2' => '内蒙古自治区 呼和浩特市 XXXXXXXXXXXXXXXX', ),)
$s =<<< TXT7 业务类型:淘宝 推荐物流 客户下单时间:2013-07-01 13:15:41发货人姓名:锐锐邮编:510510电话:手机:1356004XXXX发货人地址:广东省 广州市 天河区 XXXXXXXXXXXXXXXXXXXXXX 商品名:点击查看商品数量:1物流号:LP00015767554XXX运单号:297915XXXX上门取货段: 至 备注: 收货人姓名:蒋X邮编:4电话:手机:1820783XXXX收货人地址:广西壮族自治区 XXXXXXXXXXXXXXXX 预分配网点:750001 广东省江门市接单情况:已分配网点 接单网点: 8 业务类型:淘宝 推荐物流 客户下单时间:2013-07-01 13:15:40发货人姓名:锐锐邮编:510510电话:手机:1356004XXXX发货人地址:广东省 广州市 XXXXXXXXXXXXXXXXXXXXXXX 商品名:点击查看商品数量:2物流号:LP00015772361XXX运单号:29791555XX上门取货段: 至 备注: 收货人姓名:刘X邮编:4电话:手机:1332001XXXX收货人地址:江西省 南昌市 XXXXXXXXXXXXXXXXXXXX 预分配网点:750001 广东省江门市接单情况:已分配网点 接单网点: 9 业务类型:淘宝 推荐物流 客户下单时间:2013-07-01 13:15:37发货人姓名:锐锐邮编:510510电话:手机:1356004XXXX发货人地址:广东省 广州市 天河区 XXXXXXXXXXXXXXXXXXXXXX 商品名:点击查看商品数量:1物流号:LP00015771613XXX运单号:29791555XX上门取货段: 至 备注: 收货人姓名:闫X邮编:4电话:手机:1514809XXXX收货人地址:内蒙古自治区 呼和浩特市 XXXXXXXXXXXXXXXX 预分配网点:750001 广东省江门市接单情况:已分配网点 接单网点: TXT;preg_match_all('/(发货人姓名|手机|发货人地址|运单号|收货人姓名|收货人地址):(.+)/', $s, $r);print_r($r);
[1] => Array ( [0] => 发货人姓名 [1] => 手机 [2] => 发货人地址 [3] => 运单号 [4] => 收货人姓名 [5] => 手机 [6] => 收货人地址 [7] => 发货人姓名 [8] => 手机 [9] => 发货人地址 [10] => 运单号 [11] => 收货人姓名 [12] => 手机 [13] => 收货人地址 [14] => 发货人姓名 [15] => 手机 [16] => 发货人地址 [17] => 运单号 [18] => 收货人姓名 [19] => 手机 [20] => 收货人地址 ) [2] => Array ( [0] => 锐锐 [1] => 1356004XXXX [2] => 广东省 广州市 天河区 XXXXXXXXXXXXXXXXXXXXXX [3] => 297915XXXX [4] => 蒋X [5] => 1820783XXXX [6] => 广西壮族自治区 XXXXXXXXXXXXXXXX [7] => 锐锐 [8] => 1356004XXXX [9] => 广东省 广州市 XXXXXXXXXXXXXXXXXXXXXXX [10] => 29791555XX [11] => 刘X [12] => 1332001XXXX [13] => 江西省 南昌市 XXXXXXXXXXXXXXXXXXXX [14] => 锐锐 [15] => 1356004XXXX [16] => 广东省 广州市 天河区 XXXXXXXXXXXXXXXXXXXXXX [17] => 29791555XX [18] => 闫X [19] => 1514809XXXX [20] => 内蒙古自治区 呼和浩特市 XXXXXXXXXXXXXXXX )

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

The Storage::download method of the Laravel framework provides a concise API for safely handling file downloads while managing abstractions of file storage. Here is an example of using Storage::download() in the example controller:

Laravel simplifies HTTP verb handling in incoming requests, streamlining diverse operation management within your applications. The method() and isMethod() methods efficiently identify and validate request types. This feature is crucial for building


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 Linux new version
SublimeText3 Linux latest version
