forked from codeigniter4/CodeIgniter4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.php
More file actions
68 lines (49 loc) · 1.33 KB
/
Copy pathTest.php
File metadata and controls
68 lines (49 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php namespace App\Controllers;
use App\Mail\TestMail;
use CodeIgniter\Controller;
use CodeIgniter\Hooks\Hooks;
class Test //extends Controller
{
protected $helpers = ['url'];
public function index()
{
var_dump(codeigniter()->config->baseURL);
if ($this->request->getMethod() === 'post')
{
$file = $this->request->getFile('avatar');
if ($file->isValid() && ! $file->hasMoved()) {
$fileName = $file->getRandomName();
$file->move(WRITEPATH.'uploads', $fileName);
}
}
echo view('form');
}
//--------------------------------------------------------------------
public function hooks()
{
Hooks::trigger('myhook');
}
//--------------------------------------------------------------------
public function twodbs()
{
$db1 = \Config\Database::connect('default');
$db2 = \Config\Database::connect('tests');
echo view('form');
// d($db1->listTables());
// d($db2->listTables());
}
//--------------------------------------------------------------------
public function vfs()
{
helper('filesystem');
return view('form');
}
//--------------------------------------------------------------------
public function mail()
{
mailer(new TestMail())
->setHandler('mail')
->setTo('lonnieje@gmail.com')
->send();
}
}