草庐IT

user_key

全部标签

php - array_keys 中的跳过提交按钮

这个问题在这里已经有了答案:DeletinganelementfromanarrayinPHP(25个答案)关闭8年前。我有一个PHP例程可以处理表单并将值输出到CSV文件。我正在使用array_keys()创建标题行(如果有则跳过)。除了最后一个标题术语是“提交”之外,一切都完美无缺,因为当然,我的表单包含一个提交按钮。所以数据最终看起来像这样:name,email,cell,dob,study,submit"TempOne",fred@gmail.com,646-325-1111,1995-03-31,8,Submit"TempTwo",tom@gmail.com,646-325-

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 - 如何通过key获取数组值

我在遍历由html输入创建的数组时遇到一个奇怪的问题。这是我的html:如果我提交表单然后我得到这样的数组:$var=$_POST['new_date'];echo"";print_r($var);echo"";//outputArray(['rule']=>Array([0]=>rule_5a6c50ff02fff)['date']=>Array([0]=>2018-05-24))如果我正在尝试使用键rule的数组,那么我什么也得不到或者是空的。print_r($var['rule']);//output.....empty......请帮忙。时间差 最佳

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 - openssl_pkey_export 和 "cannot get key from parameter 1"

我需要在我的php项目中使用openssl,所以我使用openssl创建了一个测试php页面。但是,我不断收到这些错误,我不确定为什么。openssl已启用。Warning:openssl_pkey_export()[function.openssl-pkey-export]:cannotgetkeyfromparameter1inC:\wamp\www\opensslsample\index.phponline18Warning:openssl_pkey_get_details()expectsparameter1toberesource,booleangiveninC:\wamp\

php - 将 array_key_exists 与 preg_match 结合使用

我正在尝试根据模式确定一个或多个匹配项是否存在于数组中,数组的例子:Array([author_id]=>1[channel_id]=>1[site_id]=>1[entry_id]=>6[url_title]=>test_title_with_file2[title]=>TestTitlewithfile[field_id_1_directory]=>1[field_id_4_directory]=>1[submit]=>Submit[entry_date]=>1278219110)我想确定field_id_x_directory键或多个键是否存在,如果存在,则循环遍历每个键并运行一

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

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

php - yii : how to display the different menu(s) by user role?

问:如何根据用户角色显示不同的菜单?描述:该应用程序有很多角色。例如人力资源经理、客户经理、运营经理、员工、运算符(operator)……等。我使用权限和yii-user模块来创建这些角色。这些角色具有不同的功能。所以应用程序会在登录后为不同的用户角色显示不同的菜单。现在,我可以为不同的用户锁定该功能。例如,当HR经理登录时,他/她无法路由到用户角色的其他功能。但我不知道如何只显示人力资源经理的人力资源菜单。我不是yii的新手。但我是这些模块(rihgts和yii-user)的新手。 最佳答案 如果您使用RBAC例如,您可以根据用户

php - 如何让 PHP 5.3.8 读取 .user.ini 文件?

我有一台运行Apache2.2.21和PHP5.3.8的MacOSX服务器我想在每个目录的基础上设置一些php.ini风格的指令。根据PHPmanualpage,自PHP5.3.0以来,通过在包含您想要影响的脚本的目录中放置一个名为“.users.ini”的文件,可以在每个目录的基础上覆盖主php.ini运行时配置文件中的指令.对我来说,这个解决方案比使用.htaccess文件中包含的php_value和php_flag指令更可取,但是我创建的.user.ini文件被PHP忽略了。根据phpinfo(),我的.user.ini文件应该每5分钟重新缓存一次,并且文件名正确设置为“.use

php - 自定义 is_unique_logical_key - 验证还是回调?

能否请我对以下问题提出设计建议:我正在使用Codeigniter/Grocery_CRUD。我的系统是Multi-Tenancy的-不同的自治站点-在同一个客户端中。我有很多具有唯一逻辑键的表实例。一种这样的表结构是:装备元素编号(pk)equip_type_id(fktoequip_types)site_id(fktosites)姓名其中(equip_type_id,site_id,name)在一起是我数据库中的唯一键。问题是,当使用grocery_CRUD表单添加或编辑违反此数据库规则的记录时-添加或编辑失败(由于数据库中的限制)但我没有得到任何反馈。我需要is_uniquefor