我想这将是一个愚蠢的问题,但我不知道这里发生了什么.我想通过.htaccess文件中的正则表达式匹配一组特定的URI.
我想要以下内容
所以:
^[^.]+$
Run Code Online (Sandbox Code Playgroud)
用于匹配URI中没有点的所有文件.
\.html?$
Run Code Online (Sandbox Code Playgroud)
匹配所有.html/.htm文件
(^[^.]+$)|(\.html?$)
Run Code Online (Sandbox Code Playgroud)
似乎结合两者
(^[^.]+$)|(\.html?$)|(\.php$)
Run Code Online (Sandbox Code Playgroud)
无法将事物与以php结尾的匹配文件组合在一起.例如test.jpg匹配,而不应该匹配.
我一定错过了一些明显的东西.它是什么?谢谢.
更新:这是我使用的整个上下文:
### REWRITE RULES ###
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (^[^.]+$)|(\.html?$)|(\.php$) bootstrap.php [L,QSA]
Run Code Online (Sandbox Code Playgroud)
bootstrap.php包含:
echo "testing bootstrap";
Run Code Online (Sandbox Code Playgroud)
查询不存在的.jpg
http://localhost/test.jpg
Run Code Online (Sandbox Code Playgroud)
给我这个输出:
testing bootstrap
...
Run Code Online (Sandbox Code Playgroud)
更新2:
在测试下面的第一个答案后,我发现使用简单的:
RewriteRule \.php$ bootstrap.php [L,QSA]
Run Code Online (Sandbox Code Playgroud)
以与上述相同的方式失败.它匹配test.jpg.虽然服务器配置或.htaccess文件中没有什么疯狂的...这就是.htaccess文件中的全部内容,除了我已发布的内容:
AddType application/x-httpd-php .html
AddType application/x-httpd-php .xml
DirectoryIndex index.php
ErrorDocument 404 /errors/404.php
Run Code Online (Sandbox Code Playgroud)
答案:(无法再将我自己的问题再提出8个小时......)
谢谢大家帮助我.
特别感谢@mario,他通过下面的评论帮我解决了这个问题.
这确实是一个愚蠢的问题.以下是发生的事情:
rewrite.log:
strip per-dir prefix: D:/Web_Root/test.jpg -> test.jpg
applying pattern '\.php$' to uri 'test.jpg'
pass through …Run Code Online (Sandbox Code Playgroud) 我正在构建最新的dcraw.c的跨平台OS X版本.我在OS X 10.6.8上执行此操作以获得PPC兼容性.现在我的问题是strnlen似乎在最新版本的程序中使用,它在10.6.8上不存在,gcc给我这样的消息:
Undefined symbols for architecture i386:
"_strnlen", referenced from:
...
Undefined symbols for architecture ppc:
"_strnlen", referenced from:
...
Run Code Online (Sandbox Code Playgroud)
所以,我想定义strnlen但不太清楚如何.
问:任何人都可以在dcraw.c中提供strnlen的工作定义吗?
我的gcc编译命令是这个btw:
gcc -o dcraw -O4 -Wall -force_cpusubtype_ALL -mmacosx-version-min=10.4 -arch i386 -arch ppc dcraw.c -lm -DNODEPS
Run Code Online (Sandbox Code Playgroud) 我有一个用JQuery 1.4制作的例子
这是html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Formularseite</title>
<link href="style3.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="js/jquery-1.7.js" ></script>
<script type="text/javascript" src="js/meineScripts.js" ></script>
</head>
<body>
<?php
if (isset($_POST['senden']))
{
}
else { ?>
<form action="formular.php" method="POST" enctype="Multipart/Formdata">
<fieldset>
<legend>Demo1 JQuery</legend>
<label for="auswahl1">Auswahl treffen:</label>
<input class="grouptrigger" type="checkbox" id="auswahl1" name="daten[0]" value="true"/>
<br/>
<div class="auswahl1 hide_on_start">
<label for="eineZeile">Text:</label>
<input type="text" id="eineZeile" name="daten[1]" value=""/>
</div>
<input class="grouptrigger" type="radio" id="auswahl2a" name="daten[2]" value="1" />
<label for="auswahl2a">Option 1</label>
<input class="grouptrigger" type="radio" id="auswahl2b" name="daten[2]" …Run Code Online (Sandbox Code Playgroud) 我正在尝试从http://www.ece.uvic.ca/~frodo/jasper/使用libjasper 作为静态库,以从http://www.cybercom.net/~dcoffin/dcraw/编译dcraw.c 。在带有VC9的Windows上。我已经解决了几个问题,最后遇到了三个链接错误。
1>dcraw.obj : error LNK2001: unresolved external symbol _ftello
1>dcraw.obj : error LNK2001: unresolved external symbol _fseeko
1>dcraw.obj : error LNK2001: unresolved external symbol _getc_unlocked
Run Code Online (Sandbox Code Playgroud)
我补充说,其中的前两个很容易解决
#define fseeko _fseeki64
#define ftello _ftelli64
Run Code Online (Sandbox Code Playgroud)
这样就可以了,但是第三个呢?
1>dcraw.obj : error LNK2001: unresolved external symbol _getc_unlocked
Run Code Online (Sandbox Code Playgroud)
如何使用Visual Studio在Windows上解决该问题?
谢谢。
我在熊猫中有两个数据框,如下所示:
df1: df2:
Column1 Column2 Column3 ColumnA ColumnB ColumnC
0 a x x 0 c y y
1 c x x 1 e z z
2 e x x 2 a s s
3 d x x 3 d f f
Run Code Online (Sandbox Code Playgroud)
我现在想要做的是将 Column1 与 ColumnA 进行比较,并将 df2 的行附加到在 Column1 中与 df2 在 A 列中具有相同值的 df1 行,以便结果如下所示:
df1:
Column1 Column2 Column3 ColumnB ColumnC
0 a x x s s
1 c x x y y
2 e x x z z …Run Code Online (Sandbox Code Playgroud) 如果我在Objective C中有两个变量,那么将另一个变量保存为字符串
NSInteger result = 4;
NSString * theName = @"result";
Run Code Online (Sandbox Code Playgroud)
我如何使用字符串而不是对变量的引用来最好地访问第一个变量?例如,如果我有很多变量并且会通过代码生成我需要的名称,那么我需要一种方法来使用该字符串来获取变量.
我正在学习Swift,并找到了一个精彩的教程,解释了如何创建纸牌游戏.重点是我们使用14张牌卡片,图像文件名为card0,card1 ......等.
因此,我们必须使用这些文件名创建字符串数组.老师用硬编码做的
var cardNamesArray:[String] = ["card1","card2","card3","card4","card5","card6","card7","card8","card9","card10","card11","card12","card13"]
Run Code Online (Sandbox Code Playgroud)
我想用for-in做.但是,当我尝试这样做时:
for i in 0...13 {
var cardNamesArray:String = [String(format: "card%i", i)]
}
Run Code Online (Sandbox Code Playgroud)
我在XCode上遇到错误......"预期声明".
你能否指出我错在哪里,或者是否还有其他方法可以做到.
我想在JS中选择<br />一个<p></p>带有正则表达式的段落中的所有出现.目前我只选择<br />这样的:
var regex = /<br\s*[\/]?>/gi;
Run Code Online (Sandbox Code Playgroud)
但是这样做会给我带来麻烦,因为我正在尝试选择.我需要一个更精确的正则表达式,因为标题等中断与我无关.
如果你想知道这个的上下文,我想<br />用适当的类替换带有两个段落的's,就像一个<br />但是在中断后缩进文本,如下所示:
function removeEmptyNodes(selector)
{
$(selector).each(function() {
if ($(this).html().replace(/\s| /g, '').length == 0)
$(this).remove();
});
};
function assignIndents()
{
var str = $("#content").html();
var regex = /<br\s*[\/]?>/gi;
$("#content").html(str.replace(regex, "</p><br /><p>"));
$('br').prev('p').addClass('br');
$('br').next('p').addClass('indent');
removeEmptyNodes('#content p');
$('br').next('.scroller').children('p').first().addClass('indent');
$('br').replaceWith('');
removeEmptyNodes('#content p');
};
Run Code Online (Sandbox Code Playgroud)
编辑:
我的目标是我有一个带有一个或多个换行符的段落.像这个简单的案例:<p>with some text <br />and another line<p>.我希望换行后的文本缩进并且是自己的ap.所以我需要拆分原来的p.我不想在原始段落中添加div或其他嵌套的东西.我最后需要一堆兄弟p标签:<p class="br">with some text</p><p class="indent">and another line<p>
通过哪种方式我替换<br />'s来分割p对我来说无关紧要......