Jump to content

an extra "1" is appearing??


RON_ron

Recommended Posts

A

<?php
echo "names/new_batch/DataSheet.pdf";
?>

 

B

<?php
$link = require( dirname( __FILE__ ) . '/../../../../essentials/myData.php' );
echo ($link);
?>

 

when i call B the result is is shown with an extra "1" at the end

 

names/new_batch/DataSheet.pdf1

 

What am I doing wrong? How can I get the output as "names/new_batch/DataSheet.pdf"

Link to comment
https://forums.phpfreaks.com/topic/256712-an-extra-1-is-appearing/
Share on other sites

require statements insert the content of the required file in place of the require statement. They don't return the content of the file (edit: unless you are using a URL.) The only time (edit: when you are using a file system path) a value other than a true/1 (success) or false (failure) is returned by a require statement is if you use a return statement in the required file.

 

 

How do I put this in my email code? When i use the code below, it shows the URL as "1"?

<?php
$link = require( dirname( __FILE__ ) . '/../../../../essentials/myData.php' );
return ($link);

//rest of the code

<a href='http://www.web.com.au/'".$link."' target='_blank'> <img src='http://www.web.com.au/dir/image_mail.gif' style='max-width:110px;' mc:label='image' mc:edit='tiwc200_image00' /></a>

//rest of the code
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.