STHTTPRequest和php创建自定义错误代码

STHTTPRequest和php创建自定义错误代码,php,ios,iphone,sthttprequest,Php,Ios,Iphone,Sthttprequest,我在应用程序中使用sthttprequest和php进行web服务器通信。这是一个示例请求: -(void)GetSomething:(NSString*)Username :(NSString*)Password { __block STHTTPRequest *up = [STHTTPRequest requestWithURLString:[NSString stringWithFormat:@"%@%@",PATHSERVER,@"getsomething.php"]]; up.P

我在应用程序中使用sthttprequest和php进行web服务器通信。这是一个示例请求:

-(void)GetSomething:(NSString*)Username :(NSString*)Password {


__block STHTTPRequest *up = [STHTTPRequest requestWithURLString:[NSString stringWithFormat:@"%@%@",PATHSERVER,@"getsomething.php"]];

up.POSTDictionary = @{@"username":Username,@"password":Password};

up.completionBlock = ^(NSDictionary *headers, NSString *body) {


       //my result data




};

up.errorBlock = ^(NSError *error) {
    NSLog(@"-error description and error code- %@", [error localizedDescription]);

};

[up startAsynchronous];

}
当出现条件时,我想在我的php页面中输出一个错误,以在sthttprequest error的块中显示一个警报:

up.errorBlock = ^(NSError *error) {
NSLog(@"-error description and error code- %@", [error localizedDescription]);

};
是否有可能从php页面强制执行自定义代码错误以实现此行为?比如:

<?php  echo $custom_error_code; ?>

up.errorBlock = ^(NSError *error) {

  if (error.code==1300){
      //this is the code i have set in php
  }

}; 
dosen对我不起作用。

这个答案为我提供了正确的方法,可以将自定义错误代码发布到正确识别它的sthttprequest

header_status(475);