草庐IT

date_str_to_timestamp

全部标签

php - 如何从 localhost :8000 to other Ip in laravel when we run "php artisan serve" 更改默认 url

我正在运行phpartisanserve命令默认结果是:Laraveldevelopmentserverstarted:http://127.0.0.1:8000我想改指向其他ip 最佳答案 您可以使用以下解决方案来解决您的问题:phpartisanserve--host127.0.0.1--port80 关于php-如何从localhost:8000tootherIpinlaravelwhenwerun"phpartisanserve"更改默认url,我们在StackOverflow上

PHP 使用 str_replace 替换或删除空行的简单方法

$line-out=str_replace('\r','',str_replace('\n','',$line-in));以上对我有用,但是,我在某处看到了一个[\n\r]示例,但我似乎找不到它。我只想去掉所有空白行。以上是在foreach循环中。感谢教导。 最佳答案 你不应该在变量名中使用-;)$line_out=preg_replace('/[\n\r]+/','',$line_in);$line_out=str_replace(array("\n","\r"),'',$line_in);手动输入:http://php.net/

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

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

php - 无法使用 str_replace 删除特殊字符

我有一个关于str_replace的小问题。我有一个带有破折号(-)的字符串,如下所示:Iwanttoremove-thedashhtml输出是Iwanttoremovethe–thedash我想这样做:$new_string=str_replace('-','',$string);我尝试用html_entity_decode解析字符串,用htmlspecialchars解析要删除的字符,但没有任何结果。我做错了什么?-编辑-这是我的脚本的完整代码:$title='SuperMarioGalaxy2-DebutTrailer';//FetchedfromtheDB,inth

Php Date 函数在实时服务器中不起作用

我正在使用以下日期函数在本地主机中使用php显示当前日期和时间并将输出显示为2013-06-2414:45:13但是当我在实时服务器中运行上面的php代码时,它显示输出为2013-06-2406:47:28。所以,任何人都知道如何在实时服务器中以24小时格式显示日期和时间。 最佳答案 这是一个时区问题。检查date_default_timezone_get();使用date_default_timezone_set('YOUR_TIMEZONE');您可以设置时区。 关于PhpDate函

php - Zend_Session : Session must be started before any output has been sent to the browser

我以前遇到过这个问题,但我不记得如何解决它。我已经创建了一个基本的(再简单不过了)Controller,我只是想向浏览器回显一些东西,我收到了这条消息:Fatalerror:Uncaughtexception'Zend_Session_Exception'withmessage'Sessionmustbestartedbeforeanyoutputhasbeensenttothebrowser...这是我的整个Controller。它显示“成功”,但也显示错误消息。我怎样才能使该错误消息静音,以便我可以简单地向浏览器回显一些内容?_helper->layout->disableLayo

php - Zend : How to get view in Bootstrap. php?

我想在Bootstrap中设置网页的标题。我在Bootstrap.php中做了这样的事情:protectedfunction_initViewHelpers(){$view=Zend_Layout::getMvcInstance()->getView();$view->headTitle('MyTitle');}我收到以下错误:Fatalerror:CalltoamemberfunctiongetView()onanon-objectin/var/www/student/application/Bootstrap.phponline7如何获取View?我也试过this.

php - CodeIgniter 自定义库错误 : Call to a member function on a non-object

我正在尝试构建一个自定义库,其中包含可在整个站点中使用的功能。在/application/libraries我创建了一个新文件CustomFuncts:ci=&get_instance();}/***@briefcheckCookie**Checksforapreviouscookie,andifexists:*@liLoadsuserdetailstoCISessionobject.*@liRedirectstothecorrespondingpage.**/publicfunctionverificaCookie(){$this->ci->load->view('index');}

php - Zend 框架 2 : Get the path to the root directory of the application

如何获取应用程序根目录的路径。在ZendFramework1中,您可以使用常量APPLICATION_PATH,我们如何在ZendFramework2中获取它?谢谢。 最佳答案 你不应该需要。如果您使用骨架应用程序,它会在应用程序根目录中执行一个chdir();因此,将从该路径创建相对路径。如果您需要完全限定的路径,请调用getcwd()。 关于php-Zend框架2:Getthepathtotherootdirectoryoftheapplication,我们在StackOverflo

PHP session.cookie_secure : Disables sessions when set to true

当我设置以下配置时:ini_set("session.cookie_secure",1);我的整个应用程序的session已禁用,我无法再写入或读取session变量。$sessionName="us";session_name($sessionName);ini_set('session.cookie_httponly',1);ini_set('session.entropy_file','/dev/urandom');ini_set('session.hash_function','whirlpool');ini_set('session.use_only_cookies',1);