草庐IT

users_class

全部标签

user-interface - 使用 PHP CLI 创建 GUI

是否可以在bashshell上使用PHPCLI在PHP中重新创建以下界面?如果有人能给我指出正确的方向-我将不胜感激。 最佳答案 据我所知,这类事情通常用ncurses完成。 关于user-interface-使用PHPCLI创建GUI,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/9402532/

php - 如何修复 Class 'Album\Controller\AlbumController' not found 错误?

我是ZendFramework2的新手。我创建了文件夹结构并粘贴了此页面中的代码片段http://framework.zend.com/manual/2.0/en/user-guide/routing-and-controllers.html关于ZendFramework2中的路由。我收到以下错误:(!)Fatalerror:Class'Album\Controller\AlbumController'notfoundinC:\wamp\www\zend\vendor\zendframework\zendframework\library\Zend\ServiceManager\Abs

php - Symfony3 : Fatal error: Class 'AppKernel' not found in .\bin\控制台

刚开始处理一个项目,我运行了composerupdate并在尝试清除缓存时遇到异常。当我尝试运行phpbin\consoleserver:run时,我收到了这条消息:phpbin\consoleserver:runPHPFatalerror:UncaughtSymfony\Component\Debug\Exception\FatalThrowableError:Fatalerror:Class'AppKernel'notfoundinCoreBundle\bin\console:27Stacktrace:#0{main}throwninCoreBundle\bin\consoleon

php - 拉维尔 5.2 : How to get the role of current user when using `Zizaco/entrust` ?

我正在使用Laravel5.2和Zizaco/entrust5.2,我的问题是:使用Zizaco/entrust时如何获取当前用户的角色?名称和角色.phpnamespaceApp\Services;useApp\User;useApp\Role;useZizaco\Entrust\EntrustRole;useIlluminate\Support\Facades\Cache;classNameAndRole{public$username;public$role;publicfunction__construct(){$user=\Auth::user();$this->userna

PHP 和 mySQLi : Do I still need to check user input when using prepare statements?

如果我在mySQLi中使用prepare语句,我是否仍然需要以任何方式转义或检查用户输入。例如,如果我有代码:$members=newmysqli("localhost","user","pass","members");$r_email=$_POST['r_email'];$check=$members->prepare("selectuser_idfromuserswhereemail=?");$check->bind_param('s',$r_email);$check->execute();$check->store_result();if($check->num_rows>0

php - 安全类(class) build

以这种方式在登录或注册类中调用__construct()是否安全:function__construct(PDO$DBH,$_POST['1'],$_POST['2']){$this->_user=$_POST['1'];$this->_pass=$_POST['2'];$this->_DBH=$DBH;}我想稍后在这个类中清理用户输入,我不确定我的代码是否适合SQL注入(inject)或XSS,因为类是用原始POST输入构造的? 最佳答案 如果您知道您清理/使用准备好的语句(即原始POST数据未按原样插入查询),那么这样做很好。事

PHP 可捕获 fatal error : Object of class could not be converted to string

我完全迷失在这里......在验证一些输入后,我创建了一个Message类的实例并尝试将数据插入数据库://sendmessage$message=$this->model->build('message',true);$message->insertMessage($uid,$user->user_id,$title,$message);插入的方法非常简单://insertanewmessagepublicfunctioninsertMessage($to_id,$from_id,$title,$body){$sql="INSERTINTOmessages(to_id,from_id

php - fatal error : Class 'PHPUnit_Framework_TestCase' not found

我正在使用XAMPP1.8.1、Windows764位、NetbeansIDE7.4我已经安装了PHPUnit。当我运行代码时,出现以下错误。Fatalerror:Class'PHPUnit_Framework_TestCase'notfoundinD:\xampp\htdocs\PHPUnit\index.phponline6代码是:assertEquals(0,count($stack));array_push($stack,'foo');$this->assertEquals('foo',$stack[count($stack)-1]);$this->assertEquals(1

php - preg_match 错误 : Compilation failed: missing terminating ] for character class

我在for循环中读取了一系列.txt文件。我在一些文本文件中放置了一个token,格式为[widget_]因此,例如,文本文件的全部内容可能是[widget_search]。另一个文本文件可能包含内容[widget_recent-posts]。其他人可能只有html格式的文本,根本没有token。在for循环中,我正在执行preg_match以查看文本文件的内容是否与我的标记模式匹配。如果匹配,我将执行一些条件代码。但是,当我运行跟踪测试以查看是否存在匹配时出现错误。错误是:警告:preg_match()[function.preg-match]:编译失败:在C:\xampplite\

php - 我应该为 User 类的唯一实例使用哪种模式?

我有这个用户类classUser{private$logged=false;private$id;publicfunctionUser(){//>Checkiftheuserisloggedinwithacookie-databaseandset$logged=true;}publicfunctionisLogged(){}publicfunctioneditPerms(){}//>othermethods}现在考虑到我不能有超过1个用户登录(当然因为我们正在谈论单个http请求)我应该在哪里存储我的istance的引用?在这种情况下,单例会很有用,但现在每个人都说单例是邪恶的(比如静