"continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
时间: 2023-07-05 14:30:20 浏览: 50
这个错误通常发生在使用 `switch` 语句时,`switch` 语句内部使用了 `continue` 语句。在 `switch` 语句内部使用 `continue` 语句时,需要指定要继续执行的 `switch` 语句的层数,例如 `continue 2` 表示继续执行外层的 `switch` 语句。
如果你没有指定要继续执行的 `switch` 语句的层数,那么 PHP 会默认为你指定为 1。这就意味着,当你在 `switch` 语句内部使用 `continue` 语句时,PHP 会认为你想要继续执行当前的 `switch` 语句,而不是外层的 `switch` 语句。
因此,如果你想要在 `switch` 语句内部使用 `continue` 语句,并且你的 `switch` 语句有多层嵌套,你需要使用 `continue 2` 或 `continue 3` 等语法来指定要继续执行的 `switch` 语句的层数。
相关问题
In 7.7, what is the best way to query from multiple indexes using Transport Java API?
In Elasticsearch 7.7, the recommended way to query from multiple indexes using the Transport Java API is to use the MultiSearchRequest API.
Here's an example code snippet for querying from multiple indexes using the MultiSearchRequest API:
```
// Create a client object
TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
.addTransportAddress(new TransportAddress(InetAddress.getByName("localhost"), 9300));
// Create a MultiSearchRequest object
MultiSearchRequest multiSearchRequest = new MultiSearchRequest();
// Add multiple search requests to the MultiSearchRequest object
multiSearchRequest.add(SearchRequestBuilders.searchRequest("index1").source(query));
multiSearchRequest.add(SearchRequestBuilders.searchRequest("index2").source(query));
// Execute the MultiSearchRequest
MultiSearchResponse multiSearchResponse = client.multiSearch(multiSearchRequest).actionGet();
// Process the response
for (MultiSearchResponse.Item item : multiSearchResponse.getResponses()) {
SearchResponse searchResponse = item.getResponse();
// Process the search response for each index
}
// Close the client object
client.close();
```
In this code snippet, we first create a TransportClient object and a MultiSearchRequest object. We then add multiple SearchRequest objects to the MultiSearchRequest object, with each SearchRequest targeting a different index. We then execute the MultiSearchRequest using the client object, and process the response for each index.
Note that the above code snippet uses the deprecated TransportClient API. It is recommended to use the Java High Level REST Client or the Java Low Level REST Client instead.
Apps targeting Android 12 and higher are required to specify an explicit value for `android
:exported` attribute in the AndroidManifest.xml file for all components (activities, services, receivers, providers). This attribute indicates whether a component is accessible from other apps or not. It helps enhance the security of Android apps by explicitly defining the accessibility of each component.
Previously, if this attribute was not specified, the default behavior was that components were considered exported. However, starting from Android 12, specifying an explicit value for this attribute is mandatory for all components.
To specify the value for `android:exported`, you need to set it to either `true` or `false` depending on your app's requirements. If you want to allow other apps to access the component, set it to `true`. If you want to restrict access to only your app, set it to `false`.
Here is an example of how the `android:exported` attribute can be set for an activity in the AndroidManifest.xml file:
```xml
<activity android:name=".MainActivity"
...
android:exported="true">
...
</activity>
```
Make sure to review and update the `android:exported` attribute for all components in your AndroidManifest.xml file when targeting Android 12 and higher to comply with the new requirement.