runtime-error 相关问题

在程序执行之后或期间检测到运行时错误。



< vec.size() and i < vec.size() - 1

在编程时,我发现我的代码在使用条件< vec.size() - 1 but was working fine for i + 1< vec.size(). here vec was an empty std::vector...

回答 2 投票 0


程序随机获取系统。AccessViolationException

type'system.AccessVioLationException'类型的例外 发生在system.windows.forms.dll

回答 4 投票 0





我如何在php中修复“未定义变量”错误? today,我已经开始学习PHP。而且,我创建了第一个PHP文件来测试不同的变量。您可以看到我的文件如下。

我在浏览器中运行此文件时发现了以下错误。 notice:未定义的变量:x in/opt/lampp/htdocs/anand/php/php/index.php in19行 NOTICE:未定义的变量:y in/opt/lampp/htdocs/anand/php/php/index.php在第29行上 我如何解决有关它的问题? 第一个错误(不确定)是因为默认情况下没有将全球范围导入到功能中(而不是“超级全球”,那是)。 您需要告诉您的功能您是在引用全局变量$x:: $x php,PHP无法判断您是否正在用同名局部变量遮蔽全局变量。 第二误差(function myTest() { global $x; // $x refers to the global variable $y=10; // local scope echo "<p>Test variables inside the function:<p>"; echo "Variable x is: $x"; echo "<br>"; echo "Variable y is: $y"; } 是未定义的),是因为本地范围就是本地。它的全部要点是$y不会从功能中“泄漏”。当然,您无法以后在代码中访问$y在定义其定义的函数之外。如果可以的话,它与全球没有什么不同。 $y 您正在遇到第一个错误,因为变量$ a无法访问全局变量的值,除非您明确声明函数内部声明。 示例#1使用全局 <?php $a = 1; /* Global scope */ function test() { echo $a; /* Reference to local scope variable */ } test(); ?> 以及您遇到的最后一个错误是因为$y在函数内定义了global $a,因此其范围仅限于该函数。 对于详细的解释,请阅读宽可变范围。 有两种使用变量globally:的情况 使用该变量的单个副本并从任何地方进行修改,即从函数内部或外部进行修改,即在全局范围内进行修改。在这种情况下,您需要在允许的函数集<?php $a = 1; $b = 2; function Sum() { global $a, $b; // If you want to access a global variable, // you have to use the 'global' keyword $b = $a + $b; } Sum(); echo $b; ?> 形式中声明。 在情况下,您需要使用用于全局变量的same标识符的单个函数的局部变量(即所有函数之外的变量);在这种情况下,您有两个变量具有相同名称,即该功能一个本地和一个全局。然后,您需要使用superglobal变量mytest()即所有全局变量的数组。我个人更喜欢这种方法来制作高效代码; 以下是两者的代码。 代码1(使用全局声明) global $x; 代码2(使用$ GLOBALS []数组) $GLOBALS SET$ x作为全球,喜欢 <?php $x = 5; // Global scope function myTest() { $y = 10; // Local scope global $x; echo "<p>Test variables inside the function:<p>"; echo "Variable x in global scope is: $x"; echo "<br>"; echo "Variable y is: $y"; } myTest(); echo "<p>Test variables outside the function:<p>"; echo "Variable x is: $x"; echo "<br>"; echo "Variable y is: $y"; ?> 或尝试以下操作: <?php $x = 5; // Global scope function myTest() { $y = 10; // Local scope $x = 23; echo "<p>Test variables inside the function:<p>"; echo "Variable x in global scope is: " . $GLOBALS['x']; echo "<br>Variable x in local scope is: $x"; echo "<br>"; echo "Variable y is: $y"; } myTest(); echo "<p>Test variables outside the function:<p>"; echo "Variable x is: $x"; echo "<br>"; echo "Variable y is: $y"; ?> 代码的行为是按预期的,但是如果您想在脚本上使用两个变量,请使用以下方式: global $x; 在php中,如果要在该函数中使用函数,则必须在函数中声明全局变量。 <?php $x = 5; // Global scope function myTest($x) { $y=10; // Local scope echo "<p>Test variables inside the function:<p>"; echo "Variable x is: $x"; echo "<br>"; echo "Variable y is: $y"; } myTest($x); echo "<p>Test variables outside the function:<p>"; echo "Variable x is: $x"; echo "<br>"; echo "Variable y is: $y"; ?> 通过在函数中宣布$ x全局,它将参考变量的全局版本。 您必须学习PHP中变量的范围。请参阅VariableScope. 在您的代码中,$ x是一个全局,因此,为了在函数开头访问函数中的该变量,即,即,即 <?php $x = 5; // Global scope function myTest(){ global $x; global $y; $y = 10; echo "<p>Test variables inside the function:<p>"; echo "Variable x is: $x"; echo "<br>"; echo "Variable y is: $y"; } myTest(); echo "<p>Test variables outside the function:<p>"; echo "Variable x is: $x"; echo "<br>"; echo "Variable y is: $y"; ?> 对于$ y,您要么通过检查isset($ y)跳过输出,要么在全局范围内分配默认值。 upput $ x在“ echo”中的“”中的“”中的“变量” $ x是:”。$ x; yii ase \ errorexception:undefined变量$启动in/var/www/tracktraf.online/frontend/frontend/controllers/telegramcontroller.php:197 堆栈跟踪: #0/var/www/tracktraf.online/frontend/controllers/telegramcontroller.php(197):yii ase \ errorhandler-> thanherror() #1 [内部功能]:前线

回答 4 投票 0

新的Ember项目:“数据”参数必须是类型字符串或实例

I使用CLI创建了一个新的Ember项目(v2.18)。当我尝试构建/服务该项目时,我会遇到以下错误。这是100%干净的项目,尚无编辑。还有fwiw,正在使用节点...

回答 2 投票 0


拨号会产生运行时错误1004当更改为单元格时[重复]

当我更改从字母到单元格的范围时,下面的部分开始产生运行时错误1004: 带有信件: application.sumif(Sheets(4).range(“ E:P”),_ 床单(6).cells(i,1).value2,_ shee ...

回答 2 投票 0

我在使用pytorch上在GPU上运行TTS(文本到语音)模型时遇到以下错误:

当使用螺纹快速连续提出多个请求时,就会发生这个问题。当请求被分开(即单个或较慢的顺序请求)时,该函数可以按预期工作,并且没有错误。但是,当多个线程同时处理文本时,错误会触发不一致。 我用来将文本分为较小的部分,将其合成为音频,并将结果保存为WAV文件:

回答 0 投票 0

VBA-方法'list'objectr'_commandBarcomBobox'失败

I在VBA中有一个子,如果用户将其粘贴到数据中,则调用另一个子来对数据进行一些分析。以下代码为: 运行时错误'-2147467259(80004005)': 方法“列表”对象'

回答 2 投票 0


毛ui中的深链接“ 我正在尝试在Maui应用中处理Deeplink;修改了AndroidManifest.xml如下:

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <application android:name="DeeplinkTest" android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"> <activity android:name="DeeplinkTest.MainActivity" android:exported="true" android:windowSoftInputMode="stateHidden|adjustResize"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <!-- Deep Link Intent Filter --> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="https" android:host="foo.com" android:pathPrefix="/bar/" /> </intent-filter> </activity> </application> </manifest> 但它插入了java.lang.runtimeException这是.net9.0。 从文件中删除后,应用程序运行良好。 怎么了? 请仅在班级中使用[Activity]和[IntentFilter]。有关活动名称的官方文件说: 活动的类型名称基于64位循环冗余检查被导出的类型的组装合格名称。这使得可以从两个不同的组件中提供相同的完全合格的名称,而不会收到包装错误。 因此,您将收到错误:当您在AndroidManifest.xml中注册活动时找不到Java.lang.Class。 首先,从androidmanifest.xml文件中删除<activity...> 然后,将[活动]和[IntentFilter]用于Mainactivity.。 <activity .. />然后深链路将起作用。

回答 1 投票 0


为什么我的ASP.NET Core 9应用程序将一堆(看似无害的)例外扔给Visual Studio Ouput面板? 我在我的ASP.NET Core 9.0 App中使用sqlite。每当我在Visual Studio中进行调试时,我都会在输出面板中遇到数百个错误: 15:43:08:084异常投掷:'Microsoft.data.sqlite.

15:43:08:084 Exception thrown: 'Microsoft.Data.Sqlite.SqliteException' in Microsoft.Data.Sqlite.dll 15:43:08:084 Exception thrown: 'Microsoft.Data.Sqlite.SqliteException' in Microsoft.Data.Sqlite.dll 15:43:08:084 Exception thrown: 'Microsoft.Data.Sqlite.SqliteException' in Microsoft.Data.Sqlite.dll 15:43:08:340 Exception thrown: 'Microsoft.Data.Sqlite.SqliteException' in Microsoft.Data.Sqlite.dll etc...

回答 1 投票 0

为什么我的ASP.NET应用程序会向Visual Studio Ouput面板投掷一堆(看似无害的)例外? 我在我的ASP.NET Core 9.0 App中使用sqlite。每当我在Visual Studio中进行调试时,我都会在输出面板中遇到数百个错误: 15:43:08:084异常投掷:'Microsoft.data.sqlite.

15:43:08:084 Exception thrown: 'Microsoft.Data.Sqlite.SqliteException' in Microsoft.Data.Sqlite.dll 15:43:08:084 Exception thrown: 'Microsoft.Data.Sqlite.SqliteException' in Microsoft.Data.Sqlite.dll 15:43:08:084 Exception thrown: 'Microsoft.Data.Sqlite.SqliteException' in Microsoft.Data.Sqlite.dll 15:43:08:340 Exception thrown: 'Microsoft.Data.Sqlite.SqliteException' in Microsoft.Data.Sqlite.dll etc...

回答 1 投票 0

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.