正如标题所说,我需要将php放在由php回应的javascript中
例如:
<?
echo ('<script language="javascript" type="text/javascript">
if (something) then (some php)')
?>
Run Code Online (Sandbox Code Playgroud)
这不是真正的代码可能有助于得到这个想法,请注意最好的方式来做我试图这样,如果可能的话.
请多多包涵.我完全是C的新手,更不用说目标C.我正在努力做一些应该简单的事情,但它不起作用.我正在扫描一串也包含符号的数字.当迷你函数通过输入字符串运行时,它会将数字附加到一个新字符串,直到它遇到一个操作符(我正在以自己的方式编写一个计算器作为学习练习.)现在我只是在做开始部分并扫描字符串和追加字符.这是我的代码:
char userInput[99];
NSMutableString *number = nil;
int i;
printf( "Please enter math: " );
scanf( "%s", userInput );
fpurge( stdin );
NSString *InputString = [NSString stringWithUTF8String:userInput];
for (i=0; i < [InputString length]; i++) {
char current = [InputString characterAtIndex:i];
if (isalnum(current)) {
[number appendString:[NSString stringWithCharacters:¤t length:1]];
NSLog(@"%@ ", number);
}
}
Run Code Online (Sandbox Code Playgroud)
对于我的生活,我似乎无法弄清楚为什么它会保持打印2012-05-02 19:23:20.935 CALC[1447:403] (null)而不是它遇到的每个数字的数值.因此,例如,如果输入的字符串中有5个数字,它将打印5次.
让我先说我是Objective C的新手.
我收到了错误
atusMenuApp[24288:303] -[__NSCFConstantString createListItem]: unrecognized selector sent to instance 0x100002450
这是我的代码:
selector = [NSMutableArray arrayWithObjects: @"nvda", @"aapl", @"goog", nil];
[selector makeObjectsPerformSelector:@selector(createListItem:) withObject:self];
- (void)createListItem:(NSString *)title {
//do some stuff
}
Run Code Online (Sandbox Code Playgroud)
现在,我已经做了很多的环顾四周,好像最大的原因这个问题的增加或缺少的:,但是我相信我正确的有到位.也许我不太了解使用makeObjectsPerformSelector得很好,因为在查找文档后我发现:
Sends to each object in the array the message identified by a given selector, starting with the first object and continuing through the array to the last object.
任何帮助都会很棒,谢谢!
$('#password').val().indexOf(/[a-z]/) != -1)
Run Code Online (Sandbox Code Playgroud)
这有用吗?如果有的话,它有什么问题,因为它不起作用.
所有的即时通讯试图做的就是查看这个用户名在饼干设置,我已经尝试过isset()和empty()没有运气.此外,我尝试$HTTP_COOKIE_VARS['username']和$username使用这些功能,无论是否设置cookie用户名,PHP都不会做任何事情.网页是假的,但我使用我知道在我的代码中工作的真实网页.
$HTTP_COOKIE_VARS['username'] = $username;
if(isset($HTTP_COOKIE_VARS['username']))
{
header("page2.html");
}
else {
header("page1.html");
}
Run Code Online (Sandbox Code Playgroud)