douduan6731 2015-09-05 14:04 采纳率: 0%
浏览 268

php文件返回html 302错误代码

HI I have the following folder structure

/app/start.php

/php/ProcessOrder.PHP

/php/Checkout.php

Checkout.php is a test api call to paypal and when i put the full URL in the browser it works great.

my Index.html makes a post to ProcessOrder.php which saves the data to my database then should work with the api to pass the details to paypal.

both processorder and checkout are in the same folder and both have the same require statement

 require ("/../app/start.php");

why does process.php return html 302, but checkout runs? I believe it's the require statement as when I rem it out the file process ok apart from the paypal also I got the database all working before starting on the paypal API.

discovered its the last line

which should take me to paypal the url https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-1PG60856DA4942405

the line code is,

header("Location: {$approvalUrl}");

this line is the same in processorder and checkout.php

  • 写回答

1条回答 默认 最新

  • douzhang7184 2015-09-05 14:11
    关注

    As you have some weird casing in your files (mixing lower and upper case) your web server is probably configured to match for mixed case extensions and redirect the client to the correct one.

    It is best practice to do all your files in lower case extensions only, and only refer them in the exact case they are on the file system. Best way to force yourself to do this properly is configure your web server such that it simply yields a 404 when the case mismatches.

    It is a very MS-DOS'y way to do otherwise, as DOS and Windows aren't strictly case sensitive, but HTTP (as most other things in the world ;)) is.

    评论

报告相同问题?

悬赏问题

  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算