草庐IT

Function-Index

全部标签

php - Laravel 5 nginx domain.com/index.php 和 domain.com/both 工作。如何重定向/index.php?

在raspberrypi2上安装了nginx和php5.6。工作出色,但我的页面仍然从xyz.com/index.php/whatever(错误)以及xyz.com/whatever(完美)加载。我不希望/index.php加载我的主页。我希望它重定向到/没有index.php。这也适用于所有子文件夹。我究竟做错了什么??这是我构建的第一台服务器,因此我们将不胜感激。谢谢。站点可用配置:server{root/data/something.com/www/something/public;indexindex.phpindex.htmlindex.htm;server_namesome

php - htaccess,授权使用 index.php 但允许一些文件夹没有任何授权

我第一次在这里发东西,通常我会找到我需要的东西,我希望你能帮助我,也许它也会帮助其他人。我有一个手工制作的mvc(只有php/html/js/bootstrap),我需要限制一些访问但允许其他访问,我尝试了一些答案但似乎对我的情况没有任何作用。这是我的目录结构:Directorystructure所以这是我的问题,我希望人们授权以允许访问index.php和所有目录。这部分很好,很容易设置。但我还需要允许他们在没有任何授权的情况下访问3个文件夹(“/datas”、“/datasProd”和“/jeux”)。我试图在我写这篇文章的那些文件夹中添加一些htaccess以允许所有人:Orde

php - CodeIgniter:使用 HTTPS 和 AWS 时如何从 url 中删除 index.php

我使用HTTPS作为主要url,并且根据GoogleSEO指南,我必须设置以下重定向http://example.com/至https://example.comhttp://www.example.com/至https://example.comhttps://www.example.com/至https://example.com我配置的重定向非常适用于主页。但是对于内部页面,只有第一个有效,而第二个和第三个在url中添加index.php。示例https://www.example.com/index.php/mobiles/apple/apple-iphone-se至https

php - wordpress中的index.php什么时候执行?

我在wordpress安装的根目录index.php中有这段代码define('WP_USE_THEMES',true);file_put_contents("/tmp/test.php",print_r($_SERVER,true));/**LoadstheWordPressEnvironmentandTemplate*/require(dirname(__FILE__).'/wp-blog-header.php');我注意到如果我注释掉最后一行,它就变成了define('WP_USE_THEMES',true);file_put_contents("/tmp/test.php",p

php - 奇怪的 PHP 错误 : function not recognizing its own parameter

我有以下功能:publicfunctionupdateCustomerInternetBanking($value,$column_to_go_by){$sql="UPDATEcustomercJOINaccount_importaiONc.account_import_id=ai.idJOINgeneric_importgiONai.generic_import_id=gi.idJOINimport_bundleibONgi.import_bundle_id=ib.idSEThas_internet_banking=1WHEREc.".$column_to_go_by."=".$th

php - 同一文件上的函数和类 : undefined function

这个问题在这里已经有了答案:autoloadfunctionsinphp[duplicate](5个答案)关闭9年前。根据PSR-0,我有一个包含类和函数定义的文件定义(自动加载):namespaceFoo;functionb(){};classBar{}我有那个类的测试,放在同一个命名空间中:namespaceFoo;classBarTest{}当我尝试访问测试类中的b()函数时,出现了一个undefinedfunction错误:namespaceFoo;classBarTestextendsPHPUnit_Framework_TestCase{publicfunctiontestS

php - 5 .htaccess 重写 : Force HTTPS, 删除 index.php,删除 .php,强制 www,强制尾部斜线

我读过很多文章,但似乎无法让所有组合的.htaccess重写一起工作。我要么得到重定向循环,要么一个或几个根本不起作用。明确地说,如果需要,我正在寻找以下5个发生的情况:确保www在所有URL上确保所有网站版本的HTTPS从url中删除index.php删除所有.php扩展名/重定向到没有.php扩展名的url可以与前一个串联:添加尾部斜杠一些例子:example.com/index.php=>https://www.example.com/www.example.com/info/really-good-info.php=>https://www.example.com/info/r

php - 为什么使用 array($this ,'function' ) 而不是 $this->function()

我正在检查一个WordPress插件,我在一个类的构造函数中看到了这个函数:add_action('init',array($this,'function_name'));我搜索并发现array($this,'function_name')是一个有效的回调。我不明白的是:为什么要使用这个方法,而不是使用$this->function_name();这是一个示例代码:classHello{function__construct(){add_action('init',array($this,'printHello'));}functionprintHello(){echo'Hello';

php - 拉维尔 5 : Find function on model that extends User

我正在使用Laravel5并且有多个模型(Patient、Therapist)从User模型扩展而来。我在数据库中有一些虚拟数据(很少有治疗师,很少有病人)。当我想通过id检索治疗师时,我尝试通过Therapist::find($id)这样做,但出现异常:'Illuminate\Database\QueryException'withmessage'SQLSTATE[23000]:Integrityconstraintviolation:1062Duplicateentry''forkey'users_email_unique'(SQL:insertintousers`几个问题:1.为

php - 更新 Google 日历 - fatal error : Call to undefined function dateTime()

我正在尝试使用PHPAPI更新Google日历。我已成功创建Google日历事件并自动获取事件ID,但是当我尝试更新事件时,出现此错误:PHPFatalerror:CalltoundefinedfunctiondateTime()inpublic_html/googleapi/calendarupdate.phponline45.它指的是行:$event->setStart.dateTime($startdatetime);这是我当前的错误PHP代码:setAssertionCredentials($credentials);if($client->getAuth()->isAcces