我正在为我的网站制作搜索功能,但我想阻止少于3个字符的搜索
if($search > 3){
header('Location: error.txt');
}
它可能非常简单。请帮忙
答案 0 :(得分:0)
您需要使用#include <stdio.h>
void gettheline (int *length, char *line);
void strreverse (char *begin, char *end);
#define MAXLENGTH 1000
int main (void)
{
int length = 0;
char line[MAXLENGTH] = ""; /* declare & initialize to zeros */
gettheline (&length, line);
if (length) {
printf ("line: %s (%d chars)\n", line, length);
strreverse (line, line + length -1);
printf (" rev: %s\n", line);
}
else
fprintf (stderr, "error: line length is zero.\n");
return 0;
}
来获取字符数。
$ echo "my dog has fleas" | ./bin/strrevgetchar
line: my dog has fleas (16 chars)
rev: saelf sah god ym