About distance acquisition of optix7.0

Hello. I am always indebted.
I am transitioning from optix6.0 to optix7.0 and studying.
Ask one basic question.
I want to get the distance of the latest point by ray tracing.
In optix6.0,
rtDeclareVariable (PerRayData_radiance, prd_radiance, rtPayload,);
I remember that I was able to get it.
Is there an equivalent variable in optix7.0?

Please start by reading through the OptiX 7 Programming Guide and API Reference: https://raytracing-docs.nvidia.com/

For the hit distance in OptiX 6 and earlier you needed to declare a float variable with the semantic rtIntersectionDistance.
https://raytracing-docs.nvidia.com/optix6/guide_6_5/index.html#programs#internally-provided-semantics
Something like this: rtDeclareVariable(float, theIntersectionDistance, rtIntersectionDistance, );

In OptiX 7 there are no semantic variables. The way to get information from OptiX 7 inside device code is to call one of the provided device-side functions:
https://raytracing-docs.nvidia.com/optix7/guide/index.html#device_side_functions#device-side-functions
The online docs have a search functionality in the top right which works quite well. Try optixGet there.

For the intersection distance you query optixGetRayTmin() inside the closest hit program.
You’ll find its link to the API reference documentation via the above OptiX 7 device-side functions link to OptIX 7 Programming Guide.
In OptiX 6 and earlier that was the float variable with semantic rtIntersectionDistance

Payloads in OptiX 7.0 to 7.3 are a maximum of eight unsigned int registers on the optixTrace() call, resp. up to 32 registers in OptiX 7.4.0 and newer versions.
https://raytracing-docs.nvidia.com/optix7/guide/index.html#device_side_functions#trace
https://raytracing-docs.nvidia.com/optix7/guide/index.html#basic_concepts_and_definitions#ray-payload

Note that you need to define how many payload registers your OptixPipeline uses.
https://raytracing-docs.nvidia.com/optix7/guide/index.html#program_pipeline_creation#module-creation

It’s recommended to use the registers if you do not need more data inside the payload.
Mans if you only need the intersection distance, you can put that 32-bit float value into one of these unsigned int payload register.

If you need more payload data you can encode a 64-bit pointer to a structure into two of these payload registers. The OptiX SDK examples show how. Just search for all optixTrace calls.

After reading the complete OptiX 7 Programming Guide, I would recommend to look through the OptiX 7 SIGGRAPH course examples, the OptiX SDK examples, and the OptiX 7 advanced examples.
Links here:
https://devtalk.nvidia.com/default/topic/1058310/optix/optix-7-0-release/
https://devtalk.nvidia.com/default/topic/998546/optix/optix-advanced-samples-on-github/post/5428301/#5428301

Thank you for your prompt reply.
I would like to continue learning optix7.0 based on your advice!