|
|
|
ช่วยหน่อยครับเกี่ยวกับการตัดคำจากข้อความครับผม ผมงงอ่ะครับ |
|
|
|
|
|
|
|
Code (PHP)
<?php
$str = <<<ABC
SNMPv2-SMI::enterprises.9.9.46.1.3.1.1.4.1.1 = STRING: "default"
SNMPv2-SMI::enterprises.9.9.46.1.3.1.1.4.1.10 = STRING: "Faculty/Staff"
SNMPv2-SMI::enterprises.9.9.46.1.3.1.1.4.1.20 = STRING: "Students"
SNMPv2-SMI::enterprises.9.9.46.1.3.1.1.4.1.30 = STRING: "Guest(Default)"
SNMPv2-SMI::enterprises.9.9.46.1.3.1.1.4.1.99 = STRING: "Management&Native"
SNMPv2-SMI::enterprises.9.9.46.1.3.1.1.4.1.100 = STRING: "trak"
SNMPv2-SMI::enterprises.9.9.46.1.3.1.1.4.1.120 = STRING: "sa"
SNMPv2-SMI::enterprises.9.9.46.1.3.1.1.4.1.1002 = STRING: "fddi-default"
SNMPv2-SMI::enterprises.9.9.46.1.3.1.1.4.1.1003 = STRING: "token-ring-default"
SNMPv2-SMI::enterprises.9.9.46.1.3.1.1.4.1.1004 = STRING: "fddinet-default"
SNMPv2-SMI::enterprises.9.9.46.1.3.1.1.4.1.1005 = STRING: "trnet-default"
SNMPv2-SMI::enterprises.9.9.46.1.2.1.1.2.1 = STRING: "CCNA3"
ABC;
preg_match_all('/\"([^"]*)\"/', $str, $found);
$matches = $found[1];
preg_match_all('/1\.([0-9]*)[[:space:]]=/', $str, $found1); // หาตัวเลข
$matches1 = $found1[1];
foreach($matches1 as $num ){ //แสดงตัวเลข
echo $num.'<br />';
}
foreach($matches as $str ){
echo $str.'<br />';
}
?>
|
|
|
|
|
Date :
2012-02-17 11:12:20 |
By :
randOmizE |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณนะครับผม
|
|
|
|
|
Date :
2012-02-20 16:44:28 |
By :
TRak |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|