質問編集履歴
1
書き方の変更
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,18 +1,31 @@
|
|
1
1
|
### 前提・実現したいこと
|
2
2
|
ファンクションの書き方がうまくいきません。
|
3
|
+
修正しました。test.phpファイルのAPACHEのコレクションをけすために
|
4
|
+
in.phpファイルに接続することで可能にしようとしています。
|
3
5
|
|
4
|
-
|
5
6
|
### 発生している問題・エラーメッセージ
|
6
7
|
|
7
8
|
```
|
8
9
|
syntax error, unexpected token "public", expecting end of file
|
9
10
|
```
|
10
11
|
|
11
|
-
### PHP
|
12
|
+
### PHP in.phpファイル
|
12
13
|
|
13
|
-
```
|
14
|
+
```
|
15
|
+
|
14
16
|
public function drop()
|
15
17
|
{
|
16
18
|
$this->command(array("dropDatabase" => 1));
|
17
19
|
}
|
20
|
+
```
|
21
|
+
```php test.php
|
22
|
+
<?php
|
23
|
+
|
24
|
+
require('in.php');
|
25
|
+
|
26
|
+
$mongo = new MongoDB\Driver\Manager('mongodb://localhost:27017');
|
27
|
+
$collection = $mongo->APACHE;
|
28
|
+
$response = $collection->drop();
|
29
|
+
|
30
|
+
?>
|
18
31
|
```
|