草庐IT

mod_name

全部标签

php - 查询字符串和 Mod 重写

我对ReWrite并不太缺乏经验(虽然也不是大师)所以我希望有人能帮助我。RewriteRule^$index.php?page=home[NC]RewriteRule^adm$index.php?page=adm_home[NC]RewriteRule^adm/statsindex.php?page=adm_stats[NC]以上是我的.htaccess文件的片段。可以看到,当有人访问http://www.example.com/adirectory/它实际上调用了index.php?page=home,如果有人访问http://www.example.com/adirectory/

php - HTAccess-Mod_rewrite

如果我使用:RewriteEngineOnRewriteRule^.*controller.php它会将所有请求发送到controller.php但是如果controller.php包含一个css文件(/assets/css/main.css)那么它就不会工作,因为当浏览器调用它时,它只会重定向到controller.php有什么办法可以解决这个问题吗? 最佳答案 您可以添加condition排除可以映射到实际存在文件的URL:RewriteCond%{REQUEST_FILENAME}!-fRewriteRule^.*contro

php - 如何在 lighttpd 中启用 mod 重写

我需要在lighttpd中启用mod_rewrite它不应该显示index.php扩展.... 最佳答案 如果我理解您的问题,您需要将/index重写为/index.php。这应该可以解决问题。server.modules+=("mod_rewrite")url.rewrite-once=("^(.*)$"=>"$1.php");请注意,这也会转发url,例如/image.jpg->/image.jpg.php。如果您需要更复杂的解决方案,请调整您的问题。 关于php-如何在lightt

php - htaccess mod_rewrite 部分 url 到 GET 变量

我有一些这样的URL:http://plutov.by/post/cubique_zf_jqueryhttp://plutov.by/post/mysql_useful_queries如何在Apachemod_rewrite的帮助下打开下一页?http://plutov.by/post/main?title=cubique_zf_jqueryhttp://plutov.by/post/main?title=mysql_useful_queries此外,这个新的重写规则是否适用于“一个入口点重写”?RewriteEngineOnRewriteCond%{REQUEST_FILENAME}

php array_filter function not found or invalid function name 不管我输入什么

我之前从未使用过array_filter函数,所以无论我使用什么作为函数名称,它都会给我错误,请尝试一下Warning:array_filter()expectsparameter2tobeavalidcallback,function'odd'notfoundorinvalidfunctionnamein我什至采取了直接从php手册页复制粘贴示例的步骤,它给了我同样的错误。代码:functionodd($var){//returnswhethertheinputintegerisoddreturn($var&1);}functioncalculate($res,$period,$el

PHP 文件上传 : keep both files if same name

在PHP中是否有任何漂亮的解决方案允许我在文件名已经存在的情况下使用自动递增数字扩展文件名?我不想在一些不可读的东西中重命名上传的文件。所以我认为这样会很好:(允许所有图像文件。)Cover.pngCover(1).pngCover(2).png… 最佳答案 首先,让我们分开扩展名和文件名:$file=pathinfo();为了便于文件检查和追加,将文件名保存到新变量中:$filename=$file['filename'];然后,让我们检查文件是否已经存在并保存新的文件名,直到它不存在为止:$i=1;while(file_exis

php - 我如何使用 mod-rewrite (iirf) 只重定向 php 文件

我目前设置了重定向(使用IIRF,但我相信这与.htaccess规则相同)以便所有文件都不会被重定向,而是直接转到URL中的文件路径,但其他所有内容被重定向到/index.php使用以下代码:RewriteCond%{REQUEST_FILENAME}!-fRewriteRule^(.*)$/index.php?request=$1[L,QSA]我还需要它来将任何.php文件(但仅限.php文件)重定向到index.php(与第二条规则相同)综上所述,'www.example.com/foo'和'www.example.com/foo.php'都需要转到索引页,但是'www.examp

php - 编译失败 : unknown property name after\P or\p

您好,我想匹配一个字符串:“\parhello\parworld”针对我的正则表达式模式->\\par但是,我得到一个Compilationfailed:unknownpropertynameafter\Por\p我相信我的正则表达式规则被视为unicode字符属性。我如何转义它并按原样运行模式?我像这样将它包含在PDO函数中。functionsqlite_regExp($sql,$db){if($db->sqliteCreateFunction("regexp","preg_match",2)===FALSE)exit("Failedcreatingfunction!");if($r

php - 是否可以像 % :name% 这样的名称绑定(bind)参数

我正在测试一个小的搜索功能:但是我遇到了一个我似乎无法解决的错误。您可以在此处查看PDO查询:$search="test1";//latertobechangesto$_POST['search'];$sql="SELECTid,nameFROMclientsWHEEnamelike%:name%orderbyidLIMIT5";$stm=$db->prepare($sql);$stm->bindParam(":name",$search);$result=$stm->execute();如您所见,我正在尝试从我的查询中绑定(bind)参数%:name%,但我不知道这是否真的可行?我收

PHP 错误 : Function name must be a string/Undefined Variable send_sms

if(!empty($_GET['new_time'])){$sql2="SELECT*FROM".$table_name."WHEREid=".$_GET['new_time'];$result2=mysqli_query($conn,$sql2);$rows=mysqli_fetch_assoc($result2);$mobile_number=$rows['mobile_number'];//Createinstancewithkey$key='AIzaSyD1tPfs4s2dYYHMkCOqNZoVsTkDyud-9Yg';$googer=newGoogleURLAPI($ke