dir1
我有一个html文件,它名为index.html
,我在同一目录.htaccess
文件中将所有网址路由到{{1} }。index.html
clled dir1
中也有一个dirctory它有一个名为dir2
的php文件。index.php
通过ajax向index.html
发送请求,当网址为index.php
时,请求正常工作,或者也可以使用localhost/dir1/
或localhost/dir1/index.html
如果网址为localhost/dir1/anything_here
,则.htaccess
文件无法正常工作,或者当网址为localhost/dir1/anything/
时也是如此。这个问题的解决方案是什么?
答案 0 :(得分:0)
解决方案是使用绝对URL而不是相对URL。因此,基本上,请求应该/path/to/the/php/file.php
而不是path/to/...
答案 1 :(得分:0)
您可以使用from PIL import Image
def calculate_scale(file_path, bound_size):
# check the image size without loading it into memory
im = Image.open(file_path)
original_width, original_height = im.size
# calculate the resize factor, keeping original aspect and staying within boundary
bound_width, bound_height = bound_size
ratios = (float(bound_width) / original_width, float(bound_height) / original_height)
return min(ratios)
# use with xlsxwriter
image_path = 'asdf.png'
bound_width_height = (240, 240)
resize_scale = calculate_scale(image_path, bound_width_height)
worksheet.insert_image(cell, image_path, {'x_scale': resize_scale, 'y_scale': resize_scale})
部分中的base
标记:
head