how to get post slug from url in wordpress

You can use get_queried_object() which holds the current queried object from where you can get the page slug which is held by the post_name property.

You can use as:

if ( is_page() )
    // // Get the page slug using queried object
    $my_slug = get_queried_object()->post_name;

Hope this will help you.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)