質問編集履歴
1
完全版のコードを加筆しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -16,4 +16,20 @@
|
|
16
16
|
//array(2) { [0]=> string(57) "2021/08/31 -0.00364 0.08545 0.05727 0.11636 0.14636 2021/" [1]=> string(40) "-0.00364 0.08545 0.05727 0.11636 0.14636" }
|
17
17
|
```
|
18
18
|
|
19
|
-
改行等のパターン修飾子も付してみたのですが、どうしても変数代入から取得できず、なぜこのような現象がおきるのかわからず、ご助言と解決方法をご教示いただきたく、お願い申し上げます。
|
19
|
+
改行等のパターン修飾子も付してみたのですが、どうしても変数代入から取得できず、なぜこのような現象がおきるのかわからず、ご助言と解決方法をご教示いただきたく、お願い申し上げます。
|
20
|
+
|
21
|
+
【追記】完全版のコード
|
22
|
+
[利用ライブラリ](https://packagist.org/packages/spatie/pdf-to-text)([他参考にしたもの](https://pgmemo.tokyo/data/archives/1636.html))
|
23
|
+
php ver:7.4.1
|
24
|
+
```php
|
25
|
+
// ini_set('display_errors', "On");
|
26
|
+
use Spatie\PdfToText\Pdf;
|
27
|
+
require_once __DIR__ . '/vendor/autoload.php';
|
28
|
+
|
29
|
+
$parser = new \Smalot\PdfParser\Parser();
|
30
|
+
$pdf = $parser->parseFile('https://www.jbatibor.or.jp/rate/pdf/JAPANESEYENTIBOR210831.pdf');
|
31
|
+
$get_contents = $pdf->getText();
|
32
|
+
var_dump($get_contents); //正しく出力
|
33
|
+
preg_match("@2021/08/31 (.+?) 2.../@",$get_contents,$res);
|
34
|
+
var_dump($res); //array(0){}
|
35
|
+
```
|