38 lines
1.2 KiB
PHP
38 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
class Home extends BaseController
|
|
{
|
|
public function index()
|
|
{
|
|
$this->mongoDbTest();
|
|
$data['envID'] = getenv('ENV_ID');
|
|
$data['home_background'] = getenv('HOME_PAGE_BACKGROUND');
|
|
return view('welcome_message',$data);
|
|
}
|
|
|
|
public function test()
|
|
{
|
|
echo "hello world, from home controller";
|
|
phpinfo();
|
|
}
|
|
public function mongoDbTest(){
|
|
$client = new \MongoDB("mongodb://chiefsoft:may12002@10.0.0.32:27017/","mongoClient");
|
|
|
|
try {
|
|
// Send a ping to confirm a successful connection
|
|
$client->selectDatabase('admin')->command(['ping' => 1]);
|
|
//echo "Pinged your deployment. You successfully connected to MongoDB!\n";
|
|
log_message('critical', "Pinged your deployment. You successfully connected to MongoDB!");
|
|
} catch (Exception $e) {
|
|
log_message('critical', "Pinged your deployment. You failed connected to MongoDB! :: ".$e->getMessage());
|
|
// printf($e->getMessage());
|
|
}
|
|
|
|
//$client->createDBRef()
|
|
// $currDb = $client->createCollection("traffic");
|
|
//$currDb->insert()
|
|
}
|
|
}
|