我想在代码中使用类DB,我的代码这个文件klasa.php在目录助手(Ja zamierzam użyć klasy DB w kodzie mój klasy .php w catalogu helpers)文件klasa.php
<?php
//namespace App'Helpers;
//use ...'Form;
namespace App'Http'Controllers;
use DB;
use App'Quotation;
class SomeClass
{
public static function SomeMethod()
{
print "<font color=red>Dobrze</font>";
}
public static function dodaj_staty($ip,$http_user_agent,$co_robil) {
//$system = $this->system_operacyjny($http_user_agent);
//$przegla = $this->przegladarka($http_user_agent);
$system = "tomi";
$przegla = "tomek";
$sql = 'INSERT INTO statystyki (aa, bb, cc,fff,gg,iii)
VALUES (?, ?, ?,?,?,?)';
$data = time();
$data1 = array($data, $system ,$przegla,$http_user_agent,$co_robil,$ip);
//on this line return error PHP Fatal error: Class 'App''Helpers''SomeClass' not found
'DB::insert($sql, $data1);
}
这个函数在文件中调用(www.funkcje wywołuje plik)
$a = new 'App'Helpers'SomeClass();
$a->dodaj_staty('d','dd','g');
你看到的使用这些说明(wy widzicie użyłem takich instrkcji)
namespace App'Http'Controllers;
use DB;
use App'Quotation;
在这个应用程序本身是使用登录,这使用mysql,它工作得很好,也许是因为没有使用指令DB::select。我改变了指令DB::insert at $ff = DB::select,而不是它是任何错误,但如何打印机变量$ff然后看到错误。