为什么我在php连接中有科学记数法

I have to call to an endpoint of an API Restful where the last element is the resource id

http://midomain.com/resurces/:resourceID

The resourceId is 666769510661446146 but when I concact this number to the url

$url = "http://midomain.com/resources/" . $myId;      

Php returns http://midomain.com/resources/6.6676951066145E+17

I try to fix casting the number to double and using sprintf but always it's the same

Thanks!

Have you tried using number_format?

$url = "http://midomain.com/resources/" . number_format($myId,0,"","");

This way you will avoid scientific representation. Take a look to the official documentation for more info

You can see an example here