Skip to content

Instantly share code, notes, and snippets.

@vuthaihoc
Created August 18, 2020 01:50
Show Gist options
  • Save vuthaihoc/87271218a9f45e3f050f582b4accaff8 to your computer and use it in GitHub Desktop.
Save vuthaihoc/87271218a9f45e3f050f582b4accaff8 to your computer and use it in GitHub Desktop.
Parse link dạng range
@vuthaihoc
Copy link
Author

Ví dụ

http://example.com/listing?page={1-10}

Output

"http://example.com/listing?page=1"
"http://example.com/listing?page=2"
"http://example.com/listing?page=3"
"http://example.com/listing?page=4"
"http://example.com/listing?page=5"
"http://example.com/listing?page=6"
"http://example.com/listing?page=7"
"http://example.com/listing?page=8"
"http://example.com/listing?page=9"

@vuthaihoc
Copy link
Author

Ví dụ 2

https://123doc.net/document/{418400-418420,1}-bang-cong-thuc-tich-phan-dao-ham-mu-logarit.htm

Output

"https://123doc.net/document/418400-bang-cong-thuc-tich-phan-dao-ham-mu-logarit.htm"
"https://123doc.net/document/418401-bang-cong-thuc-luong-giac-dung-cho-10-11-12.htm"
"https://123doc.net/document/418402-an-toan-dien.htm"
"https://123doc.net/document/418403-hack-wifi-wpa2.htm"
"https://123doc.net/document/418404-tin-hoc.htm"
"https://123doc.net/document/418405-chuong-iv-bai-3-hinh-cau-dien-tich-mat-cau-va-the-tich-hinh-cau.htm"
"https://123doc.net/document/418406-tin-hoc.htm"
"https://123doc.net/document/418407-tin-hoc.htm"
"https://123doc.net/document/418408-tin-hoc.htm"
"https://123doc.net/document/418409-tin-hoc.htm"
"https://123doc.net/document/418410-tin-hoc.htm"
"https://123doc.net/document/418411-cau-hoi-trac-nghiem-phan-uddt-vao-chon-giong.htm"
"https://123doc.net/document/418412-tom-tat-van-ban.htm"
"https://123doc.net/document/418413-tin-hoc.htm"
"https://123doc.net/document/418414-tin-hoc.htm"
"https://123doc.net/document/418415-bai-tap-dao-ham-ham-so-luong-giac.htm"
"https://123doc.net/document/418416-giao-an-vat-ly-6-tiet-26.htm"
"https://123doc.net/document/418417-adn.htm"
"https://123doc.net/document/418418-giao-an-vat-ly-6-tiet-27.htm"
"https://123doc.net/document/418419-giao-an-vat-ly-6-tiet-29.htm"

@nguyenhiepvan
Copy link

https://123doc.net/document/{418400-418420,1}-bang-cong-thuc-tich-phan-dao-ham-mu-logarit.htm

anh ơi cái đoạn này

 $client->head($_url, [
                            'on_stats' => function (TransferStats $stats) use (&$_url) {
                                $_url = $stats->getEffectiveUri();
                            }
                        ]);

sao có thể check ra các link sống như kia nhỉ ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment