{"id":261,"date":"2009-03-04T07:29:05","date_gmt":"2009-03-04T07:29:05","guid":{"rendered":"http:\/\/www.phpmind.com\/blog\/?p=261"},"modified":"2010-07-17T01:35:46","modified_gmt":"2010-07-17T01:35:46","slug":"how-to-get-the-page-name-of-the-current-url","status":"publish","type":"post","link":"https:\/\/www.phpmind.com\/blog\/2009\/03\/how-to-get-the-page-name-of-the-current-url\/","title":{"rendered":"How to get the page name of the current URL?"},"content":{"rendered":"<p>Using this script you can get PHP current page from a url.<\/p>\n<pre name=\"code\" class=\"php\">\r\nfunction CPageName() {\r\n return substr($_SERVER[\"SCRIPT_NAME\"],strrpos($_SERVER[\"SCRIPT_NAME\"],\"\/\")+1);\r\n}\r\n\r\necho \"The current page name is \".CPageName();\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Using this script you can get PHP current page from a url. function CPageName() { return substr($_SERVER[&#8220;SCRIPT_NAME&#8221;],strrpos($_SERVER[&#8220;SCRIPT_NAME&#8221;],&#8221;\/&#8221;)+1); } echo &#8220;The current page name is &#8220;.CPageName();<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-261","post","type-post","status-publish","format-standard","hentry","category-ajax"],"_links":{"self":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/261","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/comments?post=261"}],"version-history":[{"count":14,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/261\/revisions"}],"predecessor-version":[{"id":858,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/261\/revisions\/858"}],"wp:attachment":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/media?parent=261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/categories?post=261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/tags?post=261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}