使用Model::paginate($per_page)分页时,将返回包含per_page变量的分页。问题是,当您获得时,nextPageUrl()它仅提供?page=xurl变量,因此,如果您想per_page在url中指定,例如
不会将其添加LengthAwarePaginator到next / prev网址中。
是否有我缺少的东西,还是必须手动将其附加到URL?
我正在使用Laravel 5.2 Job并对其进行排队。当失败时,将failed()在工作中触发该方法:
class ConvertJob extends Job implements SelfHandling, ShouldQueue
{
use InteractsWithQueue, DispatchesJobs;
public function __construct()
{
}
public function handle()
{
// ... do stuff and fail ...
}
public function failed()
{
// ... what exception was thrown? ...
}
}
Run Code Online (Sandbox Code Playgroud)
在该failed()方法中,如何访问Job失败时引发的异常?
我知道我可以捕获Exception,handle()但是我想知道它是否可以在其中访问failed()
我创建了一个UIImageView允许异步加载图像的类别:
@implementation UIImageView (ImageLoader)
- (void) asyncLoadImageIntoView:(NSURL *)imageURL withLoadingIndicator:(BOOL)isLoadingIndicator {
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:imageURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60];
(void)[[NSURLConnection alloc] initWithRequest:request delegate:self];
}
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
// responseData = [[NSMutableData alloc] init];
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
NSLog(@"didReceiveData %@", data);
(void)[self.image initWithData:data];
}
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
//[textView setString:@"Unable to fetch data"];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSLog(@"Succeeded! Received image data");
}
@end
Run Code Online (Sandbox Code Playgroud)
我的问题是,即使connection:didReceiveData:调用该方法并将数据打印到控制台,[self.image initWithData:data]似乎也没有将图像加载到视图中.这里有什么问题?
我在.htaccess中有一个重写规则
RewriteRule ^page/(.*)$ my-php-page.php?cid=$1
我传递的编码字符串包含像=和的字符+- 这是编码的字符串;
V1ihnKpip6WpnY7Wm5zn2+6YUtLf2KCh4eKY
当它在完整的URL中时
http://www.example.com/my-php-page.php?cid=V1ihnKpip6WpnY7Wm5zn2+6YUtLf2KCh4eKY
现在这不符合+标志.所以我想发送cid随后变成的urlencoded;
http://www.example.com/my-php-page.php?cid=V1ihnKpip6WpnY7Wm5zn2%2B6YUtLf2KCh4eKY
该+标志变成%2B.这很好用,除非我通过.htaccess中的RewriteRule尝试这个 - 它不起作用.所以URL就是
http://www.example.com/page/V1ihnKpip6WpnY7Wm5zn2%2B6YUtLf2KCh4eKY
mypage.php文件实际上接收了cid由于V1ihnKpip6WpnY7Wm5zn2 6YUtLf2KCh4eKY某种原因替换%2B为空格.
任何想法为什么它可能会这样做?我该如何解决呢?非常感谢您的帮助.
编辑
我刚刚找到了这个解决方案 - 带有urlencode和"&"bug的PHP $ _GET var - 但是我想知道是否有更优雅的解决方案而.htaccess不是urlencode两次使用字符串?
我正在尝试使用jQuery show并隐藏哪些似乎在Safari中正常工作,当我在iPhone上试用它时,它根本不起作用.这是我的代码;
<script type="text/javascript">
$("#showSearch").click(function () {
$("#searchform").show(1000);
});
</script>
Run Code Online (Sandbox Code Playgroud)
这是一个按钮,单击该按钮将显示搜索表单.该表格未在iPhone上显示.此外,当我$('#showSearch').remove();在那里添加时,它不会被删除,即使我添加一个函数,因为它的第二个参数show()仍然没有隐藏按钮.
谢谢你的帮助.
laravel ×2
php ×2
.htaccess ×1
apache ×1
cocoa-touch ×1
iphone ×1
mod-rewrite ×1
objective-c ×1
show-hide ×1
urlencode ×1