【问题标题】:Autodesk Forge :: Error 404 on localhost:3000Autodesk Forge :: localhost:3000 上的错误 404
【发布时间】:2020-09-30 07:00:18
【问题描述】:

我正在尝试制作本教程(从这里 Forge : View your models )(php),我得到了带有 HTTP 错误 404 的空白页面,知道吗? 调试器中什么都没有,其他任何地方都没有... 调用此 uri http://localhost:3000/api/forge/oss/buckets 时出现此错误

( ! ) Notice: Undefined index: id in D:\ArMediaCG\www\...\AutoCad API Extention\apps\Forge\first_tutorial\server\oss.php on line 54
Call Stack
#   Time    Memory  Function    Location
1   0.8060  405488  {main}( )   ...\index.php:0
2   0.8591  519816  Klein\Klein->dispatch( )    ...\index.php:50
3   0.8661  552248  Klein\Klein->handleRouteCallback( ) ...\Klein.php:572
4   0.8661  552248  call_user_func:{D:\ArMediaCG\www\...\AutoCad API Extention\apps\Forge\first_tutorial\vendor\klein\klein\src\Klein\Klein.php:859} ( )    ...\Klein.php:859
5   0.8661  552248  {closure:D:\ArMediaCG\www\...\AutoCad API Extention\apps\Forge\first_tutorial\index.php:27-30}( )   ...\Klein.php:859
6   0.8661  552288  Autodesk\ForgeServices\DataManagement->getBucketsAndObjects( )  ...\index.php:29

( ! ) Fatal error: Uncaught InvalidArgumentException: Missing the required parameter $bucket_key when calling getObjects in D:\ArMediaCG\www\...\AutoCad API Extention\apps\Forge\first_tutorial\vendor\klein\klein\src\Klein\Klein.php on line 925
( ! ) Klein\Exceptions\UnhandledException: Missing the required parameter $bucket_key when calling getObjects in D:\ArMediaCG\www\...\AutoCad API Extention\apps\Forge\first_tutorial\vendor\klein\klein\src\Klein\Klein.php on line 925
Call Stack
#   Time    Memory  Function    Location
1   0.8060  405488  {main}( )   ...\index.php:0
2   0.8591  519816  Klein\Klein->dispatch( )    ...\index.php:50
3   0.8751  667432  Klein\Klein->error( )   ...\Klein.php:629

在尝试使用 localhost:3000/www/index.html 进行调试后,我在 oss.php 文件的第 65 行得到了这个 Notice: Only variables should be passed by reference。我还注意到已加载令牌和旧存储桶

【问题讨论】:

  • 此异常被触发,因为bucket_key 未被提供给调用。这很奇怪,因为样本确实处理了这个异常。你能展示一下这背后的相关代码吗?
  • 您好,谢谢,不知道如何获取该 ID,我正在执行此代码 here

标签: php autodesk-forge


【解决方案1】:

我不确定这是否是一个解决方案,让我们试试: 当去 localhost/www/ 它显示页面但不加载任何东西,在第 65 行的 oss.php 中,我已经用这些替换了该行:

$cbkeyParts = explode('-', $cbkey);
$cbtext = ForgeConfig::$prepend_bucketkey && strpos($cbkey, strtolower(ForgeConfig::getForgeID())) === 0 ? end($cbkeyParts) : $cbkey;

end(explode('-', $cbkey)); 出错,explode 函数应该被移除并替换为一个变量。

现在只需使用 localhost:3000 而不是添加 /www/index.html,看起来 .htaccess 重写规则在 VS Code 的 php 服务器上不起作用,所以我尝试使用 apache 仍然无法正常工作。

【讨论】:

    【解决方案2】:

    就像 Samuel 在 cmets 中指出的那样,bucket key 没有提供给后端处理程序,因此出现了错误。

    但实际上前端不处理空/不正确的桶键输入,因此在后端调用了错误...如果您喜欢here,您可以实现自己的(检查输入的桶键是否有效)捕捉空输入...

    【讨论】:

    • 您好,谢谢,但不知道如何获取该 ID,我正在使用您发送给我的代码 [这里](您好,谢谢,不知道如何获取该 ID,我'正在做这个代码here。另外,我不确定我应该调用哪个网址
    • 我刚刚使用了 dot NET 代码并且 UI 运行良好,我发现有两个使用 php 版本创建的存储桶,但 php 从未显示它们(不是我使用 /www/index .html 在 php 中创建这些存储桶,我很困惑 html 如何创建它们并没有得到它们,无限期地显示加载图标)
    • 有趣的 Bryan,我想知道为什么错误消息与 try catch 语句中定义的错误消息不同。这解释了很多。干杯
    猜你喜欢
    • 2017-01-20
    • 2021-01-08
    • 2021-12-03
    • 2017-03-25
    • 2017-12-07
    • 2018-05-10
    • 2020-04-15
    • 2018-09-26
    • 2019-07-21
    相关资源
    最近更新 更多